JavaScript displaying a float to 2 decimal places
You could do it with the toFixed
function, but it's buggy in IE. If you want a reliable solution, look at my answer here.
float_num.toFixed(2);
Note:toFixed()
will round or pad with zeros if necessary to meet the specified length.