KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've done some searching around the documentation, and spent a while on the net but cannot find a solution to this! I want the alert to tell me which iteration of each() it was on when the .thumb is clicked. EG: There are six .thumb's I click on number 3, the browser pops-up 3! What actually happens is regardless of which .thumb is clicked, 6 pops up. var counter = 1; $('.thumb').each(function () { $(this).click(function () { alert (counter); }); counter++; }); Any help is gratefully received.
Tags (comma-separated)
Save Edits
Cancel