如何使用jQuery选择没有特定类名的元素?

如何使用jQuery选择没有特定类名的元素?

问题描述:

突击队如何像我一样,使用臭名昭著且功能强大的jQuery Sizzle CSS和其他功能(选择器)来选择没有名为"active"的类的元素巫婆?

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?

我尝试过:

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

但是没有给出足够的结果.

But it gives no adequate results.

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

应该工作

您也可以工作.刚刚测试: http://jsfiddle.net/UP6a7/

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