numeric.js is an easy-to-use jQuery plugin which permits only numeric values being entered into an input field. Supports both positive and negative values.
See also:
How to use it:
1. Load the JavaScript file jquery.numeric.js
after loading jQuery library.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="jquery.numeric.js"></script>
2. Active the plugin on your input field.
$('input').numeric()
3. Disable the negative values.
$('input').numeric({ negative: false })
Changelog:
2018-08-19
- Use deep feature detection (avoid bugs in Edge)
This awesome jQuery plugin is developed by danielgindi. For more Advanced Usages, please check the demo page or visit the official website.