Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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