Jquery Validation range method bug
martonl opened this issue · 2 comments
martonl commented
Hi All,
I found a bug in Jquery Validation 1.11 Range validation method.
This line is buggy:
return this.optional(element) || ( value >= param[0] && value <= param[1] );
Because this line checks strings, not numbers. If I have a range between 30 and 200, and I want to validate 120, then the string 120 is lesser then string 30.
This line must be something like this:
return this.optional(element) || ( Number(value) >= Number(param[0]) && Number(value) <= Number(param[1]) );
gnarf commented
Is this a bug report for a plugin? Go file it on the plugin... Wait, I see you already have... jquery-validation/jquery-validation#626 (comment)
martonl commented
yes, after this issue, I found better place for it. Sorry!