Search code examples
jquerycssclassjquery-selectorssizzle

How to select an element which doesn't have a specific class name, using jQuery?


How could a Commando, like myself, select an element witch does not have a class named "active", using the infamous and powerful jQuery Sizzle CSS and everything else - Selector?

I've tried with:

$('a[class!="active"]').etc();

But it gives no adequate results.


Solution

  • $('a:not(.active)')
    

    should work


    yours works as well. just tested: http://jsfiddle.net/UP6a7/