Javascript restrict input once 2 decimal places have been reached - Stack Overflow

PHOTO EMBED

Thu Sep 15 2022 05:55:59 GMT+0000 (Coordinated Universal Time)

Saved by @rtanguyen #javascript

var validate = function(e) {
  var t = e.value;
  e.value = (t.indexOf(".") >= 0) ? (t.substr(0, t.indexOf(".")) + t.substr(t.indexOf("."), 3)) : t;
}
content_copyCOPY

https://stackoverflow.com/questions/46321683/javascript-restrict-input-once-2-decimal-places-have-been-reached