Search code examples
jquerynumberformatter

Get jQuery numberformatter working


I have the jQuery numberformatter-plugin installed, but don´t get it to work correctly. I cannot find the correct commands on the net.

I want to format the value of a text field, which contains a number with two decimal places (like 0.16), to display 4 decimal places (0.1600).


Solution

  • You don't need any plugins for that:

    var value = value.toFixed(4); // Cuts number to 4 decimal places (doesn't do rounding)