In jQuery, how does one go about finding all the 'unchecked' checked boxes.
$(':checkbox:checked');
appears to be me all checked boxes, but what I need is all non-checked boxes.
In jQuery, how does one go about finding all the 'unchecked' checked boxes.
$(':checkbox:checked');
appears to be me all checked boxes, but what I need is all non-checked boxes.
You use the :not
selector, like so:
$('input:checkbox:not(:checked)');
Or the .not
function, like so:
$('input:checkbox').not(':checked');
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.