EmKayDK / jstepper

A jQuery plugin usable for making a numeric textfield value easy to increase or decrease
ISC License
18 stars 6 forks source link

Compare input with minValue only when focus lost #15

Open Benzolitz opened 9 years ago

Benzolitz commented 9 years ago

Building upon @loicfevrier 's Pull request (https://github.com/EmKayDK/jstepper/pull/3).

EmKayDK commented 9 years ago

Thanks (again) for the pull request. Can you provide a configuration that will cause the error(s)?

Thanks in advance.

Benzolitz commented 9 years ago

Point 1:

$('#txtTesting').jStepper({minValue: 10, maxValue: 20, minLength: 2});

After you typed in 10, try to change the number to 11. When I remove the 0 to add another 1, the script automatically changes the value to minValue. Only possiblities to change:

Point 2: I can't reproduce the error now, sorry. The problem was that I had a maxValue of 20 and when I typed in a 9 the script would change it to 20, because he would check if "9" > "20", which is true because both are strings.

Point 3: Just a minor pet peeve of mine ^^. https://github.com/EmKayDK/jstepper/blob/master/jquery.jstepper.js : Row 128

strValue < o.minValue && strValue != ''"

You first check strValue < minValue and then check if strValue even contains something. The logical order makes no sense for me.

Example:

strValue = "", minValue = 5

your code: check if strValue < minValue AND then check if strValue even contains something. my code: check if string Value contains something.