How can I select all elements without a given class in jQuery?
You could use this to pick all li
elements without class:
$('ul#list li:not([class])')
You can use the .not()
method or :not()
selector
Code based on your example:
$("ul#list li").not(".active") // not method
$("ul#list li:not(.active)") // not selector
What about $("ul#list li:not(.active)")
?
http://api.jquery.com/not-selector/