mardi 4 août 2015

Format decimal value in JQuery: From 2 to 4 decimals only showing significant values (not 0)

I'm trying to format any number like 123.40 in jQuery using

`decimals.toFixed(4);` // round

That is giving to me a result like 123.4000, but I want only 123.40 and if the value is 123.4786 then it should show 123.4786.

I want to use min value 2 and max value 4 for decimal formatting like we are doing in JSP fmt.tld tag file can any one suggest how I can achieve this.

Aucun commentaire:

Enregistrer un commentaire