如何使用jQuery选择没有特定类名的元素? [英] How to select an element which doesn't have a specific class name, using jQuery?

查看:183
本文介绍了如何使用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/

这篇关于如何使用jQuery选择没有特定类名的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆