Author: | amiryxe |
---|---|
Views Total: | 14,173 views |
Official Page: | Go to website |
Last Update: | November 29, 2022 |
License: | MIT |
Preview:

Description:
A really simple JavaScript plugin that lets you format a number with a custom character (default: comma) as a thousands separator.
How to use it:
1. Import the easy-number-separator.js JavaScript library.
<script src="easy-number-separator.js"></script>
2. Attach the easyNumberSeparator to the input field you specify and done.
<input type="text" class="number-separator" placeholder="Enter Your Number..." />
easyNumberSeparator({ selector: '.number-separator', })
3. Customize the thousands separator. Default: comma(,).
easyNumberSeparator({ selector: '.number-separator', separator: '.' })
4. If you want to send data to the server, you can set a result input by resultInput
property and hold the original value.
<input type="text" id="result_input" name="">
easyNumberSeparator({ selector: '.number-separator', separator: ',', resultInput: '#result_input', })
Changelog:
11/29/2022
- fix: fire separator on appended fields
06/22/2022
- fix bug in default configs and decimal separator
11/21/2021
- fix: run separator on phone keyboards
10/19/2021
- create result input to hold original value
10/08/2021
- JS Update