Examples

raw 0.10 1.00 123.145 5318008
formatMoney 0.10 1.00 123.145 5318008
formatMoney (€) 0.10 1.00 123.145 5318008
formatNumber 0.10 1.00 123.145 5318008
formatNumber (2) 0.10 1.00 123.145 5318008
toFixed (2) 0.10 1.00 123.145 5318008

Usage

Quickstart

Include accounting.js and jQuery.accounting.

<script src="/path/to/accounting.js"></script>
<script src="/path/to/jquery.accounting.js"></script>

Use the API as you like.

$('div').accounting('formatMoney');

Methods

The methods and options attempt to mimic accounting.js as close as possible.

$('div').accounting(method, options);
Method Options Description
formatNumber

precision number

The number of digits to right of decimal


thousand string

The character to use for the thousands separator


decimal string

The character to use for the decimal

format a number with custom precision and localisation
formatMoney

symbol string

The currency symbol


precision number

The number of digits to right of decimal


thousand string

The character to use for the thousands separator


decimal string

The character to use for the decimal


format string

The format for the currency output. Use %s for the symbol and %v for the value.

format any number into currency
toFixed

precision number

The number of digits to right of decimal

better rounding for floating point numbers

Contact

Max Kramer

Feel free to reach out to me on GitHub or Twitter using the links below.

License

MIT

Fork me on GitHub