Hi,
I want to validate whether one element is greater then second one using validation plugin of jquery. There is no direct method available for doing this. There is one method called equalTo: but it's not doing stuff.
Hi,
I want to validate whether one element is greater then second one using validation plugin of jquery. There is no direct method available for doing this. There is one method called equalTo: but it's not doing stuff.
maybe you need something like what is in this link
something like:
$.validator.addMethod('greaterThan', function(value, element, param) { return ( IsNaN( value ) && IsNaN( $(param).val() ) ) || ( value > $(param).val() ); }, 'Must be greater than {0}.' );
$.validator.addMethod('lesserThan', function(value, element, param) { return ( IsNaN( value ) && IsNaN( $(param).val() ) ) || ( value < $(param).val() ); }, 'Must be lesser than {0}.' );
you can use this like:
number1: {required:true, greaterThan: "#number2"},
anothernum1: {required:true, lesserThan: "#anothernum2"},