Answers for "accept input only number with 2 decimal javascript"

0

only positive numbers and decimals input js

<input type="text" onkeyup="value=value.replace(/[^0-9^.]+/g,'').replace('.','$#$').replace(/./g,'').replace('$#$','.').replace(/^0+/, '')"
  th:placeholder="Please enter xxx"/>
12
Posted by: Guest on April-22-2021
0

javascript limit input to 2 decimal places

var validate = function(e) {
  var t = e.value;
  e.value = (t.indexOf(".") >= 0) ? (t.substr(0, t.indexOf(".")) + t.substr(t.indexOf("."), 3)) : t;
}
Posted by: Guest on February-04-2021

Code answers related to "accept input only number with 2 decimal javascript"

Browse Popular Code Answers by Language