Monday, February 21, 2011

Extend jquery plugin to check negative numbers

I use a jquery validation plugin and I need to add some extra checking, but I can't edit the main file. How I can do this?

From stackoverflow
  • You can add your own validation methods with addMethod function

    nazmul hasan : need more documentation
    nazmul hasan : Thanks, thank you very much......
  • yes i get the solution just taking this i got the solution ,, greaterThanZero is the class name of field to be checked

    jQuery.validator.addMethod("greaterThanZero", function(value, element) { console.log(element); return this.optional(element) || /^\d*.{0,1}\d+$/.test(value); }, "* Amount must be greater than zero");

0 comments:

Post a Comment