bootstrap-touchspin icon indicating copy to clipboard operation
bootstrap-touchspin copied to clipboard

Setting forcestepdivisibility and decimals causes change event to be triggered every time

Open tracycummins opened this issue 10 years ago • 0 comments

I found out that the change event gets triggered every time I try to navigate out of the input even though the value doesn't change when I have forcestepdivisibility to anything that is 'none' and decimals set to anything that is not 0.

My sample code: image

My Analysis: At this line, "returnval = _forcestepdivisibility(returnval);" in _checkValue method, returnval is converted into decimals if forcestepdivisibility is not set to 'none'. Then the comparison following that line would check the number val (non-decimal) with decimal returnval. This comparison will always return true even though the input never changed causing val gets set and change gets triggered.

I assume we don't want to convert val to number during the comparison. Suggest change to: if (val !== returnval.toString()) {...} instead of if (Number(val).toString() !== returnval.toString()) {...}

tracycummins avatar Jul 22 '14 19:07 tracycummins