Skip to content

Commit

Permalink
Merge pull request #87 from aceiii/master
Browse files Browse the repository at this point in the history
Fix input numeric input when decimal places full (#78)
  • Loading branch information
SamWM committed Apr 14, 2015
2 parents d58f9a3 + b0fe251 commit 7e93c29
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion numeric/jquery.numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ $.fn.numeric.keypress = function(e)
// remove extra decimal places
if(decimal && decimalPlaces > 0)
{
var selectionStart = $.fn.getSelectionStart(this);
var selectionEnd = $.fn.getSelectionEnd(this);
var dot = $.inArray(decimal, $(this).val().split(''));
if (dot >= 0 && $(this).val().length > dot + decimalPlaces) {
if (selectionStart === selectionEnd && dot >= 0 && selectionStart > dot && $(this).val().length > dot + decimalPlaces) {
allow = false;
}
}
Expand Down

0 comments on commit 7e93c29

Please sign in to comment.