How to Create a Simple Currency Converter In JavaScript

Simple-Currency-Converter

Currency converter, simple project to get you started with basic JavaScript. An easy but configurable, multilingual online currency converter that permits the person to shortly convert cash to a different currency.

currency converter javascript github, currency converter source code in javascript, currency converter html code free, convert usd to inr in javascript

How to make use of it:

1. Insert the Currency Converter’s JavaScript and CSS records data into your web page.

<link href="./dist/currency-converter.css" rel="stylesheet" />
<script src="./dist/currency-converter.js"></script>

2. Create a container to hold the currency converter.

<div id="example"></div>

3. Initialize the foreign money converter with default options.

currencyConverter("#example");

4. Specify the default enter amount. Default: 100.

currencyConverter("#example",{
  baseAmount: 10
});

5. Determine the path to the API. Default: 100.

currencyConverter("#example",{
  currencyApi: 'https://​data.fixer.io/api/​latest'
});

6. Or instantly specify the Foreign Exchange Rates within the currencyData. Default: null.

currencyConverter("#example",{
  currencyData: { 
    AUD: 1.6376, 
    BGN: 1.9558, 
    BRL: 6.0777
  }
});

7. Customize the base & goal currency names. Default: ‘USD’ and ‘EUR’.

currencyConverter("#example",{
  fromCurrency: 'USD',
  toCurrency: 'AUD'
});

8. Determine the decimal precision. Default: 4.

currencyConverter("#example",{
  precision: 2
});

9. Determine whether or not to show the forex textual content. Default: true.

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

10. Localize the currency converter – javascript currency converter example

currencyConverter("#example",{
   locale: {
      From: "Von",
      To: "Zu",
      INR: "Indian Rupee",
      JPY: "Japanese Yen"
    }
});

11. Execute a function after transformation.

currencyConverter("#example",{
  onChange: (data) => console.log(data)
});

12. Override the default CSS classes:

currencyConverter("#example",{
  wrapperClass: null,
  inputFromAmountClass: null,
  inputFromCurrencyClass: null,
  inputToAmountClass: null,
  inputToCurrencyClass: null,
});

Easy Online Currency Converter In JavaScript, currency converter in HTML source code, currency-converter Github


See Demo And Download

Official Website(shailesh-satariya): Click Here

This superior jQuery/javascript plugin is developed by shailesh-satariya. For extra Advanced Usages, please go to the official website.