1
votes

Jquery Globalization works great.

You can format a currency doing something like this:

$("#currencyInput").val(Globalize.format(100000.25, "c"));

Is possible to reverse the formatting to be able to edit the value back? (keeping the culture format)

$("#currencyInput").val(Globalize.reverseFormat("$100,000.25", "c"));// 100000.25
2

2 Answers

0
votes

The Globalize plugin provides parseInt() and parseFloat() methods that you can use:

$("#currencyInput").val(Globalize.parseFloat("$100,000.25", 10, "c"));
0
votes

A really old question, I know, but the to remove the currency symbol and keep culture formatting:

Parse the currency-formatted string value to a number using Globalize.parseFloat, as described above.

Take that value and format it as a culture-specific number string, not currency, using Globalize.format again, but with the "n" parameter, indicating you want a number:

   var x = Globalize.format(100000.25, "c")
   x = Globalize.parseFloat(x)
   x = Globalize.format(x, "n")