craigmdennis / inputLimit

A jQuery plugin to limit the input of a text field to numbers, commas and 2 decimal places

Home Page:http://codepen.io/craigmdennis/pen/VLVWjv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Input Limit

A jQuery plugin to limit the input of a text field to numbers, commas and decimal places

Installation

  1. Include the file inputLimit.js in your project
<script src="/js/inputLimit.js"></script>

Usage

$('.js-inputlimit').inputLimit();

By default the input limit plugin only allows numbers to be entered into the input.

The <input> must be type="text"

Options

Options can be passed in as data-* attributes.

<input
  type="text"
  value="1.00
  class="js-inputlimit"
  data-limitdecimal=2
  data-limitnumber=3>

data-limitdecimal

How many decimal places. Default is false (no decimal places are allowed)

data-limitnumber

How many whole numbers are allowed (before the decimal place if present). Default is false (unlimited numbers are allowed)

About

A jQuery plugin to limit the input of a text field to numbers, commas and 2 decimal places

http://codepen.io/craigmdennis/pen/VLVWjv/

License:MIT License


Languages

Language:JavaScript 56.5%Language:CoffeeScript 43.5%