In javascript I'm multiplying the price of item and quantity to display its total.
For example: the item price be 48.00 and quantity is 3. If I multiply them in javascript, I'm getting the value like 144. But, I want as 144.00
Thanks in advance
Asked
Active
Viewed 62 times
0

Manoj kumar
- 3
- 3
-
possible duplicate of [How can I format numbers as money in JavaScript?](http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript) – James Thorpe Feb 25 '15 at 12:50
-
2Try with this... `(48.00*3).toFixed(2)` – Rakesh_Kumar Feb 25 '15 at 12:51
-
Rakesh_Kumar comment is correct. – Rossco Feb 25 '15 at 12:53
-
Some searching and you could of found something like this: http://stackoverflow.com/questions/6134039/format-number-to-always-show-2-decimal-places – Rossco Feb 25 '15 at 12:54
2 Answers
0
Here is a library I have been using for some time
http://phpjs.org/functions/number_format/
It is a reproduction of the php number_format into js

David Laberge
- 15,435
- 14
- 53
- 83