Currency mask with jQuery

Michael Stone picture Michael Stone · Jul 29, 2009 · Viewed 12.6k times · Source

I'm using the jQuery calculation and have just about everything working properly, but I need the total to display as 99.90, not 99.9 (for example).

So .toFixed() isn't working for some reason when it should be! I can't find a mask that would work with this problem. Anyone have any other ideas?

Answer

Daniel Moura picture Daniel Moura · Jul 29, 2009

You can use toFixed

var num = 99.9;
num.toFixed(2);