jquery-archive / plugins.jquery.com

The jQuery Plugins site

Home Page:plugins.jquery.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jquery Validation range method bug

martonl opened this issue · comments

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]) );

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)

yes, after this issue, I found better place for it. Sorry!