How to tell which element number i'm clicking on?
I have a table with 6 elements.. How can I know which one in the dom have I clicked on? Meaning.. I want to know that I click on tag #3 as it is the 3rd (or 4th if you count 0) in the dom..
I was thinking of just assigning an ID to each tag and that id would contain a number designating which is being clicked.. but there must be a cleaner way...
hope this is clear enough - sorry i'm tired开发者_高级运维.
just figured it out.. jquery has an .index() feature.
Im pretty sure that this is what you are looking for: http://api.jquery.com/index/#example-0
精彩评论