[jQuery] Re: How to get the number of the selected element?

2009-04-09 Thread jgmach

Thanks a lot! Works perfectly.


[jQuery] Re: How to get the number of the selected element?

2009-04-08 Thread Mauricio (Maujor) Samy Silva



I got 10 links on a site, all with the class collapsible.


jQuery:
$(document).ready(function(){
$('.collapsible').click(function() {
var indexLink = $('.collapsible').index(this);
var nClicked = indexLink + 1;
alert(nClicked);
});
});
HTML
a href=# class=collapsible1/a
a href=# class=collapsible2/a
a href=# class=collapsible3/a
...
MaurĂ­cio