Hello Everyone, In this tutorial, I am providing a JavaScript Code that helps you check all checkboxes presented on the page. You can execute this javascript code via your browser developer console. So let's see how we can do that.

After completing this unit you'll able to:
  • Execute JavaScript Code via browser console.
Code Snippet 1
 (function() {
    var aa= document.getElementsByTagName("input");
    for (var i =0; i < aa.length; i++){
        if (aa[i].type == 'checkbox')
            aa[i].checked = true;
    }
 })()
Code Snippet 2
 (function() {
    var aa = document.querySelectorAll("input[type=checkbox]");
    for (var i = 0; i < aa.length; i++){
        aa[i].checked = true;
    }
 })()
How to Execute?

Step 1: Right Click on your web page, then click on Inspect or Press F12.
Step 2: Select Console from the menu bar.

Step 3: Copy any of the above-provided javascript code snippets and paste into the console and then hit enter.

Hope your all checkboxes are checked.

See also:
Hope you like this post, for any feedback or suggestions please feel free to comment. I would appreciate your feedback and suggestions.
Thank you.