jQuery 1.4:
$('#menu li:last:not(.ignore)').addClass('last');
HTML:
<div id="menu">
<ul>
<li>item 1</li>
<li>item 2</li>
<li class="ignore">item3</li>
</ul>
</div>
.. last class is not applied to item 2. What am I doing wrong here?
Thanks
Change the order of :last and :not():
$('#menu li:not(.ignore):last')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With