jQuery验证器解绑定

前端之家收集整理的这篇文章主要介绍了jQuery验证器解绑定前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用 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&param=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');

猜你在找的jQuery相关文章