如何使用:not选择器忽略多个类? [英] How to ignore multiple classes using the :not selector?

查看:144
本文介绍了如何使用:not选择器忽略多个类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面有一个选择器,它忽略了任何lishow-all-boxes

I have this selector below where it ignores any li with the class show-all-boxes

$('.boxes li:not([class="show-all-boxes"]) input:checkbox')

添加选择器将忽略的多个类的最佳方法是什么?我认为可行的一个示例,但没有奏效:

What is the best way of adding multiple classes to be ignored by the selector? An example of this that I thought would work but it doesn't is:

$('.boxes li:not([class="show-all-boxes, show-all-circles, show-all-triangles"]) input:checkbox')

推荐答案

:not选择器可以将多个CSS选择器用作参数( http://api.jquery.com/not-selector ).例如.

The :not selector can take multiple CSS selectors as arguments ( http://api.jquery.com/not-selector ). E.g.

$('div:not(.a,.b)').empty()

http://jsfiddle.net/HFfcP/

这篇关于如何使用:not选择器忽略多个类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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