HOW TO SET ALL CHECKBOXES TO TRUE USING JAVASCRIPT?

Chris Anderson

Total Post:197

Points:985
Posted by  Chris Anderson
 2287  View(s)
Ratings:
Rate this:
  1. Chris Anderson

    Post:197

    Points:985
    How to set all checkboxes to true using JavaScript?

    //select all input tags
    function SelectAll() {
    var checkboxes = document.getElementsByTagName("input");
    for(i=0;i<checkboxes.length;i++) {
    if(checkboxes.item(i).attributes["type"].value == "checkbox") {
    checkboxes.item(i).checked = true;
    }
    }
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!