如何找到所有未选中的复选框? [英] How to find all unselected checkboxes?

查看:191
本文介绍了如何找到所有未选中的复选框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

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