Skip to content

Instantly share code, notes, and snippets.

@mjac
Created February 19, 2014 12:05
Show Gist options
  • Save mjac/9090654 to your computer and use it in GitHub Desktop.
Save mjac/9090654 to your computer and use it in GitHub Desktop.
Check all the checkboxes in a page
var allCheckboxNodes = document.querySelectorAll('input[type=checkbox]');
var allCheckboxes = Array.prototype.slice.call(allCheckboxNodes, 0);
allCheckboxes.forEach(function (node)
{
node.setAttribute('checked', 'checked');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment