1
Hello I have the following function
function CarregarMascaras() {
$('[data-mascara=numeroMonetario]').keyup(function () {
this.value = this.value.replace(/[^0-9]+[^\,]?[^0-9]+/g, '');
}).on('paste', function () {
this.value = this.value.replace(/[^0-9]+[^\,]?[^0-9]+/g, '');
});
}
Her idea is as follows, as you type she checks what’s there and keeps it in a format like: N,N. Where N is any number, but when testing it is accepting numbers of the type N,N,N or N.N.N. I would like this function to accept only numbers of the type: N,N.
What is the idea when using replace, is to take out all commas? the first case multiple or the last case multiple?
– Sergio
the idea is to accept only a comma and any number amount before and after the comma, but only a comma.
– Jester Andrade
And in this case
123456,4567893,46546132
which of the commas should stand?– Sergio
only the first: Ex 123456,456789346546132
– Jester Andrade