How to set two decimal digit in html cell?

42 Views Asked by At

The output of the data is something like x.xxxxxxxx in html.

I want to set in two decimal like x.xx.

My code is

"<TD ALIGN=CENTER>$value</TD>"
1

There are 1 best solutions below

0
On BEST ANSWER

Typically you should make the change in JavaScript but you can also use JS in HTML using the script tag. So, you can use:

<TD ALIGN=CENTER><script>document.write(parseFloat($value).toFixed(2));</script></TD>