limit decimal javascript code example
Example 1: limit numbers after decimal point in javascript
var num = 5.56789;
var n = num.toFixed(2);
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;
}