I'm using the jQuery validation plugin to validate a form, and I'd like to remove the validation and submit the form if a certain link is clicked.
I am submitting form with javascript like jQuery('form#listing').submit()
, so I must remove the validation rules/function with javascript.
The problem is that I can't figure out how to do this. I've tried things like jQuery('form#listing').validate({});
and jQuery('form#listing').validate = null
, but with no luck.
You want the resetForm() method: var validator = $("#myform"). validate( ... ... ); $(". cancel").
Adding an else statement to return the value of your error message span to a non-error state could correct this. this should display your error msg and return it to blank when a valid input is present.
Trigger the DOM submit method to skip the validation:
$("#listing")[0].submit();
You can remove events of nodes with unbind:
jQuery('form#listing').unbind('submit'); // remove all submit handlers of the form
What you are probably looking for is that the validation plugin can also unassign itself from the submit event:
jQuery('form#listing').validate({ onsubmit : false });
For both of these you should be able to follow up with a call to .submit()
to submit the form:
jQuery('form#listing').unbind('submit').submit();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With