Created
May 19, 2014 19:38
-
-
Save jerrylopez/46d90a14335f25c6932a to your computer and use it in GitHub Desktop.
Check all checkboxes
This file contains hidden or 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
| /* | |
| * | |
| * Found at : http://jsfiddle.net/YxUHw/ | |
| * | |
| * You can use this to check all check boxes just in case you have a crap load | |
| * and there is no checkall button. | |
| * | |
| */ | |
| (function () { | |
| var checkboxes = document.querySelectorAll('input[type=checkbox]'); | |
| //convert nodelist to array | |
| checkboxes = Array.prototype.slice.call(checkboxes); | |
| checkboxes.forEach(function (checkbox) { | |
| console.log(checkbox); | |
| checkbox.setAttribute('checked', true); | |
| }); | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment