Skip to content

Instantly share code, notes, and snippets.

@fuddl
Last active December 17, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuddl/5633560 to your computer and use it in GitHub Desktop.
Save fuddl/5633560 to your computer and use it in GitHub Desktop.
Uncheck all checkboxes with jQuery
jQuery(':radio').removeAttr('checked');
@Havvy
Copy link

Havvy commented May 23, 2013

document.querySelectorAll('input[type="checkbox"]').forEach(function (cb) { ch.checked = false; });

@yannickoo
Copy link

That won't work because forEach is only available for arrays. Talket with @Havvy and it ended up with:

Array.prototype.forEach.call(document.querySelectorAll('input[type="checkbox"]'),function(a){a.checked=false});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment