JQuery: not () issue
3 answers
How does your expression work:
- Find the item with the identifier "menu";
- Find all elements of the descendant list of this element;
- Limit the results to the very last element in this set;
- Filter out elements (this is only one element of this point, the last) that do not have a class of "ignore".
The last element has an ignore class, so it is filtered out. That is why it does not work. Reorder:
$("#menu li:not(.ignore):last").addClass("last");
+2