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

让人想犯罪 __ 提交于 2021-01-27 02:17:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!