jQuery Plugin For Number-only Input Fields - justnum

jQuery Plugin For Number-only Input Fields - justnum
File Size: 5.52 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

justnum is an extremely lightweight jQuery plugin used to enable the text inputs to accept only numeric values.

Features:

  • Display an alert window when you typed other characters.
  • Only allows numeric keystrokes, plus dots (.) or commas (,).

How to use it:

1. Place jQuery library and the jQuery justnum plugin at the end of the document.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="dist/justnum.min.js"></script>

2. Call the function on the input field and we're done.

$('Selector').justnum();

3. Config the plugin to allow dots (.) and commas (,).

$('Selector').justnum({allow: true});

4. The method to destroy the plugin.

$('Selector').justnum('destroy');

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