Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Validator Unbinding

I am using the jQuery Validator. And I'm trying to figure out: How can I un-attach the validator from my form once its submitted?

$(function() {
  // Just the rules, etc...
  validator = $("#sweepstakesForm").validate({rules: {fname: {required: true,minlength: 2,maxlength: 50},lname: {required: true,minlength: 2,maxlength: 50},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() {

  }
});

I have tried these to no avail:

validator = null;
$("#sweepstakesForm").unbind('validate');
delete validator;
like image 232
JREAM Avatar asked Mar 09 '12 23:03

JREAM


1 Answers

Try

$('#sweepstakesForm').data('validator', null);
$("#sweepstakesForm").unbind('validate');
like image 62
ts. Avatar answered Sep 28 '22 09:09

ts.