Java script Error help is needed
-
Hi all, iam using following java script code for validating multiple checkboxex
if((document.submitForm.check[0].checked !==true)&&(document.submitForm.check[1].checked!==true))
{
alert("Please select the one check box ");
return false;
}and html page i have declared the checkbox like this.
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Erosion Control"><font size=3>Erosion Control</font></TD>
</TR>
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Forestation"><font size=3>Forestation</font></TD>
</TR>iam getting this error document.check.0. is not object . can any body guide me in this issue that what iam doing wrong . How i debug the java script code ? i have to validate multiple checkboxes Best Regards rameez
-
Hi all, iam using following java script code for validating multiple checkboxex
if((document.submitForm.check[0].checked !==true)&&(document.submitForm.check[1].checked!==true))
{
alert("Please select the one check box ");
return false;
}and html page i have declared the checkbox like this.
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Erosion Control"><font size=3>Erosion Control</font></TD>
</TR>
<TR>
<TD align="center"> <input type="checkbox" name="check[]" value="Forestation"><font size=3>Forestation</font></TD>
</TR>iam getting this error document.check.0. is not object . can any body guide me in this issue that what iam doing wrong . How i debug the java script code ? i have to validate multiple checkboxes Best Regards rameez
Getting all the checkbox object reference use the following script. var getAllcheckbox = document.getElementsByTagName("INPUT"); for(var i=0;i<getallcheckbox.length;i++)> { if(getAllcheckbox[i].type == "checkbox" && getAllcheckbox[i].name = "check[]") { //do your validation here... } }