Easy Currency Converter Examples

Example: 1 Default options

currencyConverter("#example-1");

Example: 2 Custom currency data

currencyConverter("#example-2", {
  currencyData: {
    AUD: 1.6376,
    BGN: 1.9558,
    BRL: 6.0777,
    EUR: 1
  },
  toCurrency: "BGN"
});

Example: 3 Without bottom currency text

currencyConverter("#example-3", {
  withText: false
});

Example: 4 More custom options

const elm = document.getElementById( 'example-4' );
const cc = currencyConverter(elm, {
    baseAmount: 10,
    fromCurrency: "INR",
    toCurrency: "JPY",
    precision: 2,
    locale: {
        From: "Von",
        To: "Zu",
        INR: "Indian Rupee",
        JPY: "Japanese Yen"
    }
});


// Bind the events
elm.addEventListener( 'onReady', function ( event ) {
    // Set amount
    cc.setAmount( 500 );
} );

elm.addEventListener( 'onChange', function ( event ) {
    console.log( event.data );
} );