From 6ddb4689fb7acedd17ec46150b0553856ea2d51c Mon Sep 17 00:00:00 2001 From: Roger Saladrigas Date: Tue, 6 Oct 2015 19:29:05 +0200 Subject: [PATCH 1/4] Allow using '.' to insert non standard decimal separator. When using a non standard decimal separator, such as comma ',' allow the user to insert it using the '.' key. --- numeric/jquery.numeric.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numeric/jquery.numeric.js b/numeric/jquery.numeric.js index 6f31f69..5aadf57 100644 --- a/numeric/jquery.numeric.js +++ b/numeric/jquery.numeric.js @@ -143,6 +143,10 @@ $.fn.numeric.keypress = function(e) allow = false; } } + //if the key pressed is '.' and the decimal symbol is not present yet, add it to the field. + else if(key == 46 && $.inArray(decimal, value.split('')) == -1){ + this.value += decimal; + } } else { From a0457b8a54eda11894643f46d64e2422ade1b445 Mon Sep 17 00:00:00 2001 From: Roger Saladrigas Date: Tue, 6 Oct 2015 19:40:52 +0200 Subject: [PATCH 2/4] Revert "Allow using '.' to insert non standard decimal separator." This reverts commit 6ddb4689fb7acedd17ec46150b0553856ea2d51c. --- numeric/jquery.numeric.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/numeric/jquery.numeric.js b/numeric/jquery.numeric.js index 5aadf57..6f31f69 100644 --- a/numeric/jquery.numeric.js +++ b/numeric/jquery.numeric.js @@ -143,10 +143,6 @@ $.fn.numeric.keypress = function(e) allow = false; } } - //if the key pressed is '.' and the decimal symbol is not present yet, add it to the field. - else if(key == 46 && $.inArray(decimal, value.split('')) == -1){ - this.value += decimal; - } } else { From 2c7824faef78af185249be36025d560fd68c667f Mon Sep 17 00:00:00 2001 From: Roger Saladrigas Date: Tue, 6 Oct 2015 19:56:16 +0200 Subject: [PATCH 3/4] Allow using '.' key to insert non standard decimal separator. When using a non standard decimal separator, such as comma ',' allow the user to insert it using the '.' key. --- numeric/jquery.numeric.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numeric/jquery.numeric.js b/numeric/jquery.numeric.js index 6f31f69..e5b23b5 100644 --- a/numeric/jquery.numeric.js +++ b/numeric/jquery.numeric.js @@ -143,6 +143,10 @@ $.fn.numeric.keypress = function(e) allow = false; } } + //if the key pressed is '.' and the decimal symbol is not present yet, add it to the field. + else if(decimal && key == 46 && $.inArray(decimal, value.split('')) == -1){ + $(this).val($(this).val()+ decimal); + } } else { From 4494f1519187dcacd8ff4b61637fd8aec5ea11e5 Mon Sep 17 00:00:00 2001 From: Roger Saladrigas Date: Tue, 6 Oct 2015 21:25:57 +0200 Subject: [PATCH 4/4] Fix spacing. --- numeric/jquery.numeric.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/numeric/jquery.numeric.js b/numeric/jquery.numeric.js index e5b23b5..dfd8c8a 100644 --- a/numeric/jquery.numeric.js +++ b/numeric/jquery.numeric.js @@ -145,7 +145,7 @@ $.fn.numeric.keypress = function(e) } //if the key pressed is '.' and the decimal symbol is not present yet, add it to the field. else if(decimal && key == 46 && $.inArray(decimal, value.split('')) == -1){ - $(this).val($(this).val()+ decimal); + $(this).val($(this).val() + decimal); } } else @@ -161,7 +161,6 @@ $.fn.numeric.keypress = function(e) allow = false; } } - } return allow; };