I need a function that will loop through the checkboxes I have on my form - all with the same name - and check that at least one box is checked. If not, alert them that it is required.
Any ideas?
function NoneSelected(objCheckbox)
{
var Result = true;
for(var i=0;i<objCheckbox.length;i++)
{
if (objCheckbox[i].checked)
{
Result = false;
break;
}
}
return Result;
} //NoneSelected
call it like NoneSelected(document.formName.checkboxName)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.