Skip to content

Instantly share code, notes, and snippets.

@sabrinaluo
Created December 9, 2014 04:44
Show Gist options
  • Save sabrinaluo/6fa9fd7697bfbdfc2acf to your computer and use it in GitHub Desktop.
Save sabrinaluo/6fa9fd7697bfbdfc2acf to your computer and use it in GitHub Desktop.
find index of active element
<ul>
<li>item1</li>
<li class="active">item2</li>
<li>item3</li>
</ul>
<script>
$(ul).find(".active").index(); //return 1
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment