Format currency using javascript -


a script returns either number 0.0580 in x.xxxx format or (x) x units left.

i want format number 0.0580 , return 5.8 cent or return x units left.

any ideas how in javascript? how format x.xxxx?

in case first x not 0 want return e.g. 1.75$.

ms has written nice plugin jquery. it's useful if you're localizing. give go:

http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin-from-microsoft.aspx

i'm not sure if can used outside of jquery...


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -