jQuery.rupiah is a plugin that convert to localized number to IDR and unlocalized string IDR to number.
npm install rupiahhtml
`
You can also install using the node package managers NPM.
`sh
npm install rupiah
`
Usage
`js
$(function() {
var data = 20000, idr = {};
idr.string = data.rupiah({decimal: false});
idr.number = idr.string.rupiah({localized: false});
$('.idr').rupiah();
console.log(idr);
});
`
Where options is an optional parameter.
See below for a description of the available options and defaults.
The above example will set all selected elements with the class idr to the localized IDR.
If the selected is an input, the value of the input will be set to the localized IDR, and if the selected is not an input, the text value of element will be set to the localized IDR.
Options
The default options are:
`js
{
localized: true,
decimal: true,
}
`
Where:
* localized: true is to localized number to IDR
* localized: false is to unlocalized IDR to number
* decimal: true is to enabled 2 digits decimal of localized IDR
* decimal: false is to disabled 2 digits decimal of localized IDR
Example
`html
jQuery.rupiah
20000
``