Jquery plugin for Input Field Number to restrict entry to float or integer number and autoformat
Jquery plugin for Input Field Number to restrict entry to float or integer number and autoformat.
Just include the javascript file :
<script src="path/input-number-format.jquery.min.js" ></script>
$('.input-float').inputNumberFormat();
Name | Type | Default value | Description |
---|---|---|---|
decimal | Integer | 2 | Number of decimal authorized |
decimalAuto | Integer | 2 | Number of decimal to add automatically on blur event |
separator | String | “.” | Separator to use |
separatorAuthorized | Array (string) | [“.”, “,”] | Separators authorized |
allowNegative | Boolean | false | Allow negative number |
There are 2 differents ways to use options
$('.input-float').inputNumberFormat({ 'decimal': 4, 'decimalAuto': 4 });
<input class="input-float" type="text" data-decimal="4" data-decimal-auto="4" value="" />