Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created November 30, 2012 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loisaidasam/4175768 to your computer and use it in GitHub Desktop.
Save loisaidasam/4175768 to your computer and use it in GitHub Desktop.
Hacked Select All in Javscript
// 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