filter index of an element in an unordered set
$("ul > li").click(function () { var index = $(this).prevAll().length; });