Last active
February 7, 2020 16:50
-
-
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.
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 | |
$('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