function checkUncheckAllCheckbox()
{
f=document.frmName
if(f.mainCheckBox.checked)
{
f.checkBoxName.checked=true;
for(i=0;i<f.checkBoxName.length;i++)
f.checkBoxName[i].checked=true;
}
else if(!f.mainCheckBox.checked)
{
f.checkBoxName.checked=false;
for(i=0;i<f.checkBoxName.length;i++)
f.checkBoxName[i].checked=false;
}
}

23 thoughts on “Check or uncheck multiple checkbox at a time in javascript”
  1. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

  2. Excellent site, keep up the good work. I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,

    A definite great read.. 🙂

    -Bill-Bartmann

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.