views:

79

answers:

2

I am using the following code to work out an inc and ext VAT price:

$('#totalexvat').text(totalprice);
var vat = totalprice / 100 * 17.5;
vat = roundNumber(vat,2);
$('#totalincvat').text(totalprice-vat);

Sometimes i get .3 or .9 instead of what I would like to be .30 or .90 because it's money, is there a way to do this?

+1  A: 

try toFixed

stereofrog
+3  A: 

You may want to look at this: http://code.google.com/p/jquery-numberformatter/ since you're using jQuery already.

Pointy