I have a problem in my code.
I want to write a code of java alert while checkbox is not checked.
I have a loop of checkboxes
here is code
<?php
for ($i=0; $i<count($chk); $i++) {
echo "<input type='checkbox' name='pr' value=''/>".$chk[$i];
echo "</br>";
}
?>
and here is JavaScript
<script>
var tags = document.getElementsByName('pr'),
value = '', i = 0;
for( ; i < pr.length; i++ )
{
if( pr[i].checked=='' ) {
alert("Please Check All Checkboxes");
}
}
</script>
I want that the checkbox which are echo from loop is all checked then is proceed it to next page. If anyone checkbox is not checked it show an alert message
Problem: If i am not checked anyone checkbox it proceed, and i want it would not proceed if anyone checkbox is not checked
Aucun commentaire:
Enregistrer un commentaire