Separate Currency Number With Coma

Jan 24, 2024


easy-number-separator is a pure JavaScript plugin for formatting and separating currency numbers with coma.

Features

  1. Separate numbers by your custom character separators like comma character (,) or any other characters.
  2. Does not accept non-numeric characters.
  3. Can work on any text inputs by your selector.

How To Use

Link this CDN to your HTML file

<script src="https://cdn.jsdelivr.net/gh/amiryxe/easy-number-separator/easy-number-separator.js"></script>
  • Or add easy-number-separator.js in your html file, or your web project.
<script src="js/easy-number-separator.js"></script>
  • Make Input Field
<input type="text" class="currency-input" />
  • Select your input element
easyNumberSeparator({
    selector: '.currency-input',
    separator: ','
})

Other options you can pass

TitleDefaultDescription
selectoreg. .currency-inputSelects the input element
separator,The character of number separator
decimalSeparator.The character of decimal separator
resultInput-Raw number generated for purposes such as server submission and calculations
Options