Last active
December 17, 2015 15:39
-
-
Save fuddl/5633560 to your computer and use it in GitHub Desktop.
Uncheck all checkboxes with jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(':radio').removeAttr('checked'); |
can you make it a one-liner as well?
document.querySelectorAll('input[type="checkbox"]').forEach(function (cb) { ch.checked = false; });
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
A non jQuery version: