开发者

Reset all checkboxes on page without looping

开发者 https://www.devze.com 2023-02-06 14:03 出处:网络
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 che

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消