find all unchecked checkbox in jquery
As the error message states, jQuery does not include a :unchecked
selector.
Instead, you need to invert the :checked
selector:
$("input:checkbox:not(:checked)")
$("input:checkbox:not(:checked)")
Will get you the unchecked boxes.
You can do so by extending jQuerys functionality. This will shorten the amount of text you have to write for the selector.
$.extend($.expr[':'], {
unchecked: function (obj) {
return ((obj.type == 'checkbox' || obj.type == 'radio') && !$(obj).is(':checked'));
}
}
);
You can then use $("input:unchecked")
to get all checkboxes and radio buttons that are checked.