javascript - Jquery Validate addMethod "notEqual" causes browser crash -


i using:

jquery.validator.addmethod("notequal",      function(value, element, param) {         return this.optional(element) || value !== param;     },      "please specify different (non-default) value" ); 

then:

$(this).validate({     rules: {         address: { notequal: "address" },         building: { notequal: "building"}     },     submithandler: function() {          $(this).submit();      } }); 

to make fields not equal default values, causes browsers slow, or crash in case of webkit engines.

jquery javascript library v1.8.3 jquery validation plug-in pre-1.5.2 

can please tell me what's wrong?

update: tried replace validation plug-in to: jquery validation plugin - v1.11.1, still same result.

working sample: http://jsfiddle.net/avy9e/

you're calling submit event recursively submithandler option. instead, call native submit function on form element:

$(this).validate({     rules: {         address: { notequal: "address" },         building: { notequal: "building"}     },     submithandler: function(form) {          form.submit();      } }); 

example: http://jsfiddle.net/avy9e/2/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -