我正在使用
jQuery Validator.我想弄清楚:一旦提交,我怎么可以从我的表单中取消附加验证器?
$(function() { // Just the rules,etc... validator = $("#sweepstakesForm").validate({rules: {fname: {required: true,minlength: 2,maxlength: 50},lname: {required: true,email: {email: true,remote: "?c=home&m=jsHook¶m=email&nojson=1",required: true,minlength: 6,maxlength: 120},address: {required: true,minlength: 5,maxlength: 100},state_0: {required: true},state: ); // etc ... $('#sweepstakesForm').submit() { } });
我试过这些没有用:
validator = null; $("#sweepstakesForm").unbind('validate'); delete validator;
解决方法
尝试
$('#sweepstakesForm').data('validator',null); $("#sweepstakesForm").unbind('validate');