Skip to content

Easy Number Separator is a simple plugin for live separate input numbers in textboxes

Notifications You must be signed in to change notification settings

samedsakman/easy-number-separator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Easy Number Separator

Easy Number Separator is a useful pure JavaScript plugin for currency format and separate numbers on input.

Features

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

How to Use

  1. Add Easy Number Separator plugin to your project:
<script src="js/easy-number-separator.js"></script>
  1. Make your input text field like this:
<input type="text" class="number-separator" />
  1. Select your input element:
easyNumberSeparator({
    selector: '.number-separator',
    separator: ','
})

Options

Title Default Description
selector .number-separator Selects 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

Send data to server

If you want to send data to the server, you can set a result input by resultInput property and hold the original value.

Example:

HTML:
<input type="text" id="result_input" name="">
JavaScript:
easyNumberSeparator({
    selector: '.number-separator',
    separator: ',',
    resultInput: '#result_input',
})

CDN

<script src="https://cdn.jsdelivr.net/gh/amiryxe/easy-number-separator/easy-number-separator.js"></script>

Enjoy :)

About

Easy Number Separator is a simple plugin for live separate input numbers in textboxes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 62.1%
  • JavaScript 37.9%