Simple jQuery Input Number Formatting Plugin - Input Format

Simple jQuery Input Number Formatting Plugin - Input Format
File Size: 94.8 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

inputformat is a simple-to-use jQuery plugin used to automatically format numbers the users input based on your format settings.

Format settings available:

  • Thousand separator
  • Decimal separator
  • Allow decimals
  • Allow negative
  • Allow leading zero
  • numeric only

Basic Usage:

1. Load the jQuery inputformat plugin after jQuery library.

<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="src/jquery-inputformat.js"></script>

2. Create a normal Html input on your web page.

<input id="default" type="text">

3. Call the plugin to apply the default format setting on the input field.

$('#default').inputNumber();

4. Modify the following format settings to fit your needs.

$('#default').inputNumber({
thousandSep: ',',
decimalSep: '.',
allowDecimals: true,
allowNegative: true,
allowLeadingZero: false,
maxDecimalDigits: 'unlimited',
numericOnly: true
});

Change logs:

2014-12-30

  • bug fix for input number cannot input zero

2014-11-25

  • fix bug when dealing with numeric from numpad
  • fix conflicts

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