I have a UL List set up as follows:
<div id="menu">
<ul>
<li>
<a href="step-1" />
</li>
<li>
<a href="step-2" />
</li>
</ul>
</div>
I am trying to drill into the “a href” in that list and change a class attribute and I am having some trouble.
I have tried the following but it doesn’t seem to be doing the trick, can someone help steer me straight?
var menuItem = $('#menu ul li').find('a:has(href="#step-'+num+'")');
menuItem.removeClass('disabled');
menuItem.addClass('done');
DEMO
Note
^=is Attribute Starts With Selector selector, in this case it point out thoseawhosehrefstart withstepIn your approach
According to fiddle share in comment
not
There is nothing with
id=menu, it isid=wizardDEMO