Question

How do I remove jQuery validation from a form?

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.

 45  88857  45
1 Jan 1970

Solution

 71

Trigger the DOM submit method to skip the validation:

$("#listing")[0].submit();
2009-06-28

Solution

 36

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();
2008-12-12