I have a loop that creates 20 check-boxes in the same page (it creates different forms). I want via chrome developer tools to
To modify the accepted answer slightly, if you're trying to check all of the boxes on some services, such as Loom.com, then you'll need to click each one instead of just setting them to "checked" status, otherwise the functionality doesn't work as expected.
Here's the code to do that:
(function() {
var aa = document.querySelectorAll("input[type=checkbox]");
for (var i = 0; i < aa.length; i++){
aa[i].click();
}
})()
Please note that longer lists of checkboxes will cause the page to pause temporarily as all checkboxes get automatically clicked for you.
(function() {
var aa= document.getElementsByTagName("input");
for (var i =0; i < aa.length; i++){
if (aa[i].type == 'checkbox')
aa[i].checked = true;
}
})()
With up to date browsers can use document.querySelectorAll
(function() {
var aa = document.querySelectorAll("input[type=checkbox]");
for (var i = 0; i < aa.length; i++){
aa[i].checked = true;
}
})()