I have a for that I am submitting with this button:
<button id="registerButton" type="submit" name="submit" style="margin-left: 300px;">Click to Complete</button>
I am doing error checking with this jQuery:
$('#registerButton').bind('click',function(){
if($('#formElem').data('errors')){
alert('Please correct the errors in the Form');
return false;
}
});
When I go to submit the form it will pop up with the alert if there are errors detected on the form. However, if there are no errors the button doesn’t do anything. What am I doing wrong?
Bind the validation on the submit event of the form.