如何从表单中删除 jQuery 验证? [英] How do I remove jQuery validation from a form?
问题描述
我正在使用 jQuery 验证插件来验证表单,如果单击某个链接,我想删除验证并提交表单.
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.
我正在使用像 jQuery('form#listing').submit()
这样的 javascript 提交表单,所以我必须使用 javascript 删除验证规则/函数.
I am submitting form with javascript like jQuery('form#listing').submit()
, so I must remove the validation rules/function with javascript.
问题是我不知道如何做到这一点.我尝试过诸如 jQuery('form#listing').validate({});
和 jQuery('form#listing').validate = null
之类的东西,但是没有运气.
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.
推荐答案
触发DOM提交方法跳过验证:
Trigger the DOM submit method to skip the validation:
$("#listing")[0].submit();
这篇关于如何从表单中删除 jQuery 验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!