I'm pretty new to Jquery and I have this jquery to check if checkboxes are checked. If not the form should not execute.
It worked fine with only the #validCheck
id, but when I added the #feeCheck
it doesn't matter witch one is checked, the form executes.
what I want is that the both checkboxes must be checked for the form to execute. If they are both not checked the form should not execute.
if(!($('#validCheckbox , #feeCheckbox').prop('checked')))
{
errorMessage += "You must check the checkboxes to continue!<br/>";
errorCounter++;
ok = false;
$("#errorDiv").css({"backgroundColor": "#f9f9f9", "color": "#D2002C", "padding": "10px"});
$("#errorDiv").html(errorMessage);
}
Do I really have to write two seperate if statements for each checkbox?
I'm reusing the script for multiple forms, some of them have both checkboxes some only have the #validCheck
can someone help me with this.
Aucun commentaire:
Enregistrer un commentaire