Created
November 30, 2012 13:34
-
-
Save loisaidasam/4175768 to your computer and use it in GitHub Desktop.
Hacked Select All in Javscript
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
// Run this from the console: | |
tags = document.getElementsByTagName('input'); | |
for (i in tags) { if (tags[i]['type'] == 'checkbox') { tags[i]['checked'] = 'checked'; } } | |
// And voila! | |
// Apparently these are some other variations: | |
// 1. using JQuery | |
jQuery(':checkbox').prop('checked', true); | |
// 2. using the class name instead of the element name | |
tags = document.getElementByClassName('fooclass'); | |
for (i in tags) { if (tags[i]['type'] == 'checkbox') { tags[i]['checked'] = 'checked'; } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment