How to replace automatically all commas from a input with dots?
I have this input:
<input type="text" id="test" onChange="testfunc()"> </input>
And this is my work so far:
function testfunc() {
var testnr = document.getElementById("test").value;
testnr = testnr.replace(/,/g, '.');
}
testnr
will store the value, so this testnr = testnr.replace(/,/g, '.');
will only change the value without changing the ÌNPUT
, please try this:
<input type="text" id="test" onchange="this.value = this.value.replace(/,/g, '.')"/>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments