How to loop through all unchecked checkboxes?
Using jQu开发者_StackOverflow中文版ery, is there a fast way to loop through all unchecked checkboxes on a page that have className="carCheckboxes".
Use the .each()
method with the :not(:checked)
selector. Here are the references:
Reference to jQuery.each method
Reference to jQuery:not selector
Reference to jQuery:checked selector
$("input.carCheckboxes:not(:checked)").each (function () {
//your code to loop through each element.
//$(this) references the current element as a jQuery Object
});
精彩评论