var $a = $('a').click(function() { console.log('anchor' + $a.index(this) +' in page'); });
On Sep 12, 7:58 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have the following code > > $('a').click(function() { > console.log('anchor'+ pos+' in page); > > }); > > I'd like to be able to get the matched position number (pos) of each > element found, so if my page has 5 anchor tags, if i click on the > first a element in the page, its pos would be 1 (or 0), etc.