开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜