I have a multi-step form, when I do validations, for example the checkbox validation that checks if the none of above option has been checked, then other options or checkboxes have to be unchecked. that functionality only work when I click the previous button
event.preventDefault();
if($('input[name^="q3"]:checked').length ==0) {
$("#q3Error").html("Please select an option. If above choices do not meet your situation, click NONE OF THE ABOVE");
return false;
}else if($('input[name^="q3"]:checked').length >0){
$(".noneAbove_q3").click(function () {
$('input:checkbox').not(this).prop('checked', false);
});
$(".check_option_3").click(function () {
$(".noneAbove_q3").prop('checked', false);
});
$("#q3Error").html("");
$("#third").hide();
$("#second").hide();
$("#fourth").show();
$("#progressBar").css("width","40%");
$("#progressText").html("Step 4");
}
});
it only works after I click on previous from the next question.
Aucun commentaire:
Enregistrer un commentaire