如何找到所有未选中的复选框? [英] How to find all unselected checkboxes?
本文介绍了如何找到所有未选中的复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在jQuery中,如何查找所有未选中的复选框。
In jQuery, how does one go about finding all the 'unchecked' checked boxes.
$(':checkbox:checked');
似乎是我所有的复选框,但我需要的是所有未选中的框。 p>
appears to be me all checked boxes, but what I need is all non-checked boxes.
推荐答案
您可以使用 :not
选择器,如下所示:
You use the :not
selector, like so:
$('input:checkbox:not(:checked)');
或 .not
函数,如下所示:
Or the .not
function, like so:
$('input:checkbox').not(':checked');
另请注意,您应始终将输入
之前的过滤器如:radio
和:checkbox
,因为没有选择器被评估为 * :checkbox
这是一个非常慢的选择器。
Also note that you should always put input
before filters like :radio
and :checkbox
, as without that the selector are evaluated as *:checkbox
which is a really slow selector.
这篇关于如何找到所有未选中的复选框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文