how to limit decimal places javascript code example
Example 1: javascript snumber two decimal places as string
let money = 1.6;
money.toFixed(2); // 1.60
Example 2: 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;
}