I comment, the matter is as follows;
I'm working with HTML - jQuery and I'm using a script that replaces the dot by comma when I press it
Script
$('input.number').each(function () {
$(this).keypress(function(e){
if(e.keyCode == '46' || e.charCode == '46'){
if(document.selection){
var range = document.selection.createRange();
range.text = ',';
}else if(this.selectionStart || this.selectionStart == '0'){
var start = this.selectionStart;
var end = this.selectionEnd;
$(this).val($(this).val().substring(0, start) + ','
+ $(this).val().substring(end, $(this).val().length));
this.selectionStart = start + 1;
this.selectionEnd = start +1;
}else{
$(this).val($(this).val() + ',');
}
return false;
}
});
});
The issue is, that in text type input I have no problem
<input type="text" class="number"/>
But when I want to use an input of type number (to take advantage of not writing text)
<input class="number" type="number" lang="es-ar">
In this last case type = ' number ', when pressing the comma I have no problems, the problem arises when pressing the point of the numpad (where the Script above converts it to a comma)
When this occurs, the input is cleaned and in the console I receive the following
The specified value "3," is not a valid number .
The value must match to the following regular expression: -? (\ d + | \ d +. \ d + |. \ d +) ([eE] [- +]? \ d +)?
(anonymous) @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
each @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
each @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
val @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
(anonymous) @ VM144: 33
dispatch @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
a.handle @ jquery? v = rD9yxcIfC-_zwpaJ_9UPbUY1Niam5dFE8OFiugxkBeM1: 1
Greetings and Thank you very much in advance!