I want to validate the input on a series of checkboxes. There must be at least one checkbox selected, otherwise the user gets an alert to select one.However, the alert appears unless all of the checkboxes are selected.
I realize that the issue is how my for loop params are set, but I cannot gigure out how to fix it. PLEASE!!!! help me. Your input and direction is greatly appreciated. Oh, I am very familiar with MDN and the resources there, but they do not have the answer :).
for(var i=0;i<7;i++){
if( !checkboxes[i].checked ){
alert( 'You need to select at least one day!');
checkboxes[i].focus();
return false;
}
}
Aucun commentaire:
Enregistrer un commentaire