Featured image of post Check all checkboxes in a web page

Check all checkboxes in a web page

To check all checkboxes in a web page, open DevTools with F12, paste the following code into the console, and execute it.

1
2
3
4
5
6
let boxes = document.querySelectorAll('input[type="checkbox"]');
for (let i = 0; i < boxes.length; i++) {
    if (!boxes[i].disabled) {
        boxes[i].checked = true;
    }
}

Alternatively,

Create a new bookmark, and in the address field when registering (where you usually enter https://…), paste the following code and save it. Display the web page where you want to check the boxes, and click the created bookmark to check all checkboxes.

1
javascript:(function(){let boxes=document.querySelectorAll('input[type="checkbox"]');for(let i=0;i<boxes.length;i++){if(!boxes[i].disabled){boxes[i].checked=true;}}})();

If you want to uncheck all, change the boxes[i].checked = true; part of the above script to boxes[i].checked = false;.

comments powered by Disqus