项目作者: 24eme

项目描述 :
Jquery plugin for Input Field Number to restrict entry to float or integer number and autoformat
高级语言: JavaScript
项目地址: git://github.com/24eme/jquery-input-number-format.git
创建时间: 2015-10-24T01:08:43Z
项目社区:https://github.com/24eme/jquery-input-number-format

开源协议:MIT License

下载


Jquery input number format

Jquery plugin for Input Field Number to restrict entry to float or integer number and autoformat.

Example

Demo page

Installation

Just include the javascript file :

  1. <script src="path/input-number-format.jquery.min.js" ></script>

Usage

  1. $('.input-float').inputNumberFormat();

Options

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

  • Javascript :
  1. $('.input-float').inputNumberFormat({ 'decimal': 4, 'decimalAuto': 4 });
  • HTML with data attribute :
  1. <input class="input-float" type="text" data-decimal="4" data-decimal-auto="4" value="" />