Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zachelrath/5715629 to your computer and use it in GitHub Desktop.
Save zachelrath/5715629 to your computer and use it in GitHub Desktop.
Comparison of the complexity between jQuery and DOM Native syntax required to find all checkboxes in a given page and automatically check them.
// jQuery
$('input[type="checkbox"]').prop('checked',true);
// DOM
Array.prototype.slice.call(document.querySelectorAll('input[type="checkbox"]')).forEach(function(e){e.setAttribute("checked","checked");});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment