Search code examples
javascriptjqueryvalidation

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.


Solution

  • Trigger the DOM submit method to skip the validation:

    $("#listing")[0].submit();