Skip to content Skip to sidebar Skip to footer

Check/ Uncheck All Checkbox Of A Html Table

I have got a HTML table which contain a check box in and other checkboxes in I want that all 's checkboxes should be checked /unchecked on basis of

Solution 1:

Try the following code

var frm = document.getElementById('tblemail').getElementsByTagName("input");
varlen = frm.length;
var checkedStatus = document.getElementById(id).checked;

for (i=0;i<len;i++) 
{
    if (frm[i].type === "checkbox") 
    {    
        frm[i].checked = checkedStatus;
    }
}

Solution 2:

Have you Tried

document.getElementById(id).checked = true

Post a Comment for "Check/ Uncheck All Checkbox Of A Html Table"