The jQuery plugin for the accounting and number formatter library, accounting.js.
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 |
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');
The methods and options attempt to mimic accounting.js as close as possible.
$('div').accounting(method, options);
Method | Options | Description |
---|---|---|
formatNumber |
precision numberThe number of digits to right of decimal thousand stringThe character to use for the thousands separator decimal stringThe character to use for the decimal |
format a number with custom precision and localisation |
formatMoney |
symbol stringThe currency symbol precision numberThe number of digits to right of decimal thousand stringThe character to use for the thousands separator decimal stringThe character to use for the decimal format stringThe format for the currency output. Use |
format any number into currency |
toFixed |
precision numberThe number of digits to right of decimal |
better rounding for floating point numbers |