Whenever Delete button is clicked without selecting any Checkbox it gives validation -thats proper Whwnever checkbox is selected and button is clicked, also it shows the validation. Where am i going wrong ?
<tr>
<td>
<input type='checkbox' name='check1' value = '80'>Q- 80. Statute of Liberty is in ?
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='check1' value = '64'>Q- 64. National Animal ?
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='check1' value = '65'>Q- 65. Popular language
</td>
</tr>
<tr>
<td>
<input type='checkbox' name='check1' value = '63'>Q- 63. Largest Ocean ?
</td>
</tr>
JS:
function Checked(){
var chk=false;
if (document.myForm.check1.checked){
chk=true;
return chk;
} else {
alert("Please select Checkbox");
return chk;
}
}
My Function call:
<input type="submit" name="delete" formmethod='post' formaction='/~xyz/cgi-bin/Project/CheckDelete.py' value="Delete" onclick="return Checked()">