I'm trying validate checkbox in my java script,but always doesn't work.
what's wrong in the code below:
Html
<div class="form-group id=Knows">
<input type="checkbox" name="Knows1" id="Knows1" value="Knows1">Knows1
<input type="checkbox" name="Knows2" id="Knows2" value="Knows2">Knows2
<input type="checkbox" name="Knows3" id="Knows3" value="Knows3">Knows3
<input type="checkbox" name="Knows4" id="Knows4" value="Knows4">Knows4
<input type="checkbox" name="Knows5" id="Knows5" value="Knows5">Knows5
</div>
Java script
parent_fieldset.find('#Knows1, #Knows2, #Knows3, #knows4').each(function() {
if( $(this).checked == "false" && $("#Knows5").checked =="false") {
$(this).addClass('input-error');
next_step = false;
}
else {
$(this).removeClass('input-error');
}
});
Aucun commentaire:
Enregistrer un commentaire