问题
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.
回答1:
$('a:not(.active)')
should work
yours works as well. just tested: http://jsfiddle.net/UP6a7/
来源:https://stackoverflow.com/questions/7399956/how-to-select-an-element-which-doesnt-have-a-specific-class-name-using-jquery