How do I remove jQuery validation from a form?

后端 未结 10 1619
逝去的感伤
逝去的感伤 2020-12-02 20:10

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

10条回答
  •  悲哀的现实
    2020-12-02 20:32

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

提交回复
热议问题