KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
<ul class="bullets"> <li><a href="#">item 1</a></li> <li><a href="#">item 2</a></li> <li><a href="#">item 3</a></li> <li><a href="#">item 4</a></li> <li><a href="#">item 5</a></li> </ul> When I click on the <a> element, i'd like to get it's parent <li> 's index number. I'm trying to create a carrousel type function that doesn't need item-n classes on the list items. $(".bullets li a").click(function(){ var myIndex = $(this).parent().index(this); showPic(myIndex); }); Thanks for any help. TD.
Tags (comma-separated)
Save Edits
Cancel