Using jQuery, I\'d like to be able to get the index of the li where the contained anchor tag\'s HREF equals \"#All\". (In this case the correct result would be 3)
This should do it:
var index = $("#tabs ul li").index($("li:has(a[href='#All'])"));
instead of all s you wanted to get the index out of. element :has a link with what you want by using the :has selector, otherwise the matched element will be the itself instead of the .Tested the above and it gives me the correct answer, 3, as the index is 0-based.