Minimal Number Input Format Plugin For jQuery - Numbertor

Minimal Number Input Format Plugin For jQuery - Numbertor
File Size: 6.66 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Numbertor is a jQuery plugin that provides a simple way to automatically format numeric values your users typed in the number input.

How to use it:

1. Download and insert the minified version of the jQuery numbertor plugin after jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="fm.numbertor.jquery.js"></script>

2. Setup with JavaScript.

<input id="demo" value="1234,567">
$(function () {
  $('#demo').numbertor();
});

3. Setup with HTML markup.

<input id="demo" value="1234,567" class="numbertor">

4. Set the desired number of decimal places.

$(function () {
  $('#demo').numbertor({
    decimals: 2 // default: auto
  });
});

5. Customize the decimal and thousand separators.

$(function () {
  $('#demo').numbertor({
    decimalSeperator:  ',',
    thousandSeperator: '.',
  });
});

6. Set the input value to 0 if empty.

<input id="demo" value="1234,567" data-numbertor-allow-empty="false">
// or
$(function () {
  $('#demo').numbertor({
    allowEmpty: false
  });
});

This awesome jQuery plugin is developed by QODIO. For more Advanced Usages, please check the demo page or visit the official website.