Cec*_*ore 48 jquery jquery-selectors
我在下面有这个选择器,它忽略任何li类show-all-boxes
$('.boxes li:not([class="show-all-boxes"]) input:checkbox')
Run Code Online (Sandbox Code Playgroud)
添加多个要被选择器忽略的类的最佳方法是什么?我认为这样做的一个例子可行,但事实并非如此:
$('.boxes li:not([class="show-all-boxes, show-all-circles, show-all-triangles"]) input:checkbox')
Run Code Online (Sandbox Code Playgroud)
Tho*_*uah 87
:not选择器可以将多个CSS选择器作为参数(http://api.jquery.com/not-selector).例如
$('div:not(.a,.b)').empty()
Run Code Online (Sandbox Code Playgroud)
试试这个 :
$('.boxes li').not(".show-all-boxes, .show-all-circles, .show-all-triangles").find('input:checkbox')
Run Code Online (Sandbox Code Playgroud)