Suppose I have a value of 15.7784514, I want to display it 15.77 with no rounding.
var num = parseFloat(15.7784514); document.write(num.toFixed(1)+\"
Already there are some suitable answer with regular expression and arithmetic calculation, you can also try this
function myFunction() { var str = 12.234556; str = str.toString().split('.'); var res = str[1].slice(0, 2); document.getElementById("demo").innerHTML = str[0]+'.'+res; } // output: 12.23