I use this to validate my form, and this is normal:
$(document).ready(function() {
$("#myform").validate();
});
But I need to run the function before submitting the form, but only if the verification has passed. When I try to add a function after checking, for example:
$(document).ready(function() {
$("#myform").validate();
$('#submitButton').click(function() {
...
});
});
executed even if the form fails validation.
I also tried putting the submit function in the submitButton click, and the same thing happens - the function is executed even if the form fails validation:
$(document).ready(function() {
$('#submitButton').click(function() {
$("#myform").validate();
...
...
});
});
source
share