Using jQuery, I would like to get the li index where the contained HREF anchor tag is "#All". (In this case, the correct result would be 3)
<div id="tabs"> <ul> <li><a href="#CPU"><span>CPU</span></a></li> <li><a href="#Pickup"><span>Pickup</span></a></li> <li><a href="#Breakfix"><span>Breakfix</span></a></li> <li><a href="#All"><span>All</span></a></li> </ul> </div>
I tried:
$("#tabs ul").index($("li a[href='#All']"))
... no luck. What am I doing wrong?
jquery
Steve Horn Jun 08 '09 at 16:42 2009-06-08 16:42
source share