Last active
March 10, 2019 16:39
-
-
Save nathansmith/942659 to your computer and use it in GitHub Desktop.
Used to check all checkboxes in a page.
This file contains hidden or 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
// Paste into Firebug or Chrome Dev Tools console | |
// when viewing a page with multiple checkboxes. | |
(function(d) { | |
var input = d.querySelectorAll('input[type="checkbox"]'); | |
var i = input.length; | |
while (i--) { | |
input[i].checked = true; | |
} | |
})(this.document); |
If you use the Web Developer add on in Firefox under the Forms section you can use Populate Form Fields. Has the added benefit of populating all empty text-fields too.
I can't get either one of these scripts to work in Firebug Lite or Chrome's Dev Console. I'm actually trying to do the opposite and uncheck all checkboxes on pages that don't have an check/uncheck all. i.e. Facebook's notification page. http://cl.ly/2R2U1m1w392n2S2K0z3S Any ideas?
@kevinSuttle - This is what you need...
(function(d) {
var input = d.querySelectorAll('input[type="checkbox"]');
var i = input.length;
while (i--) {
input[i].checked = false;
}
})(this.document);
ROCK! Thanks Nathan!
Just used this on a shady recruiter. The first snippet works best.
Thanks! @nathansmith
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simply
input[i].checked = true
would work as well.Since this is meant to be used in a web inspector thingy, you could use qSA: