Reset all checkboxes on page without looping
I was wondering if it was p开发者_开发知识库ossible to reset all the checkboxes (mark them unchecked) on the page without looping using jQuery?
You can use a single selector to find all the checked checkboxes, and remove the 'checked' attribute from them. jQuery will do this internally by looping, but you will not have to write a loop yourself:
$(':checkbox:checked').removeAttr('checked');
See the :checkbox
and :checked
selectors.
精彩评论