It's supposed to add elements to array named valid if it is at least one checkbox checked, but I keep getting undefined. Help?
HTML:
<input type="checkbox" name="chbTestovi" value="Homework1"/>Homework1<br/>
<input type="checkbox" name="chbTestovi" value="Homework2"/>Homework2<br/>
<input type="checkbox" name="chbTestovi" value="Homework3"/>Homework3<br/>
JS:
for (i = 0; i < domaci.length; i++) { if(izbDomaci.checked) { izbDomaci += domaci[i].value + ", "; } }
if (izbDomaci == "") {
greske.push("Morate izbrati makar jedan domaci!");
}
else {
valid.push(izbDomaci);
}
Aucun commentaire:
Enregistrer un commentaire