Skip to content

Instantly share code, notes, and snippets.

@bekapod
Created May 22, 2012 20:32
Show Gist options
  • Save bekapod/2771441 to your computer and use it in GitHub Desktop.
Save bekapod/2771441 to your computer and use it in GitHub Desktop.
JQUERY: Find index of an element in unordered set
$('ul > li').click(function() {
var index = $(this).prevAll().length;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment