This time I will share jQuery Plugin and tutorial about Easy Number Input Validation Plugin For jQuery – numberValidation, hope it will help you in programming stack.
numberValidation is a simple, easy-to-use jQuery plugin that provides the real-time validation functionality for your numeric input fields.
Validation rules included:
- Data type: ‘integer’ or ‘double’.
- Required.
- Min/max values.
- Length.
- Decimals.
How to use it:
1. Include the compiled and minified JavaScript file ‘jquery.numbervalidation.min.js’ after jQuery library.
1 |
< script src = "//code.jquery.com/jquery.min.js" ></ script > |
2 |
< script src = "jquery.numbervalidation.min.js" ></ script > |
2. Include the Bootstrap framework for full features.
1 |
< link href = "bootstrap.min.css" rel = "stylesheet" > |
2 |
< script src = "bootstrap.min.js" ></ script > |
3. Call the function and apply a validation rule of your choice to the input field.
01 |
$( "#myInput" ).masknumber({ |
13 |
type: "The value is not integer" , |
14 |
required: "The value is required" , |
15 |
minvalue: "The value is less than -3" , |
16 |
maxvalue: "The value is greater than 100" |
21 |
tooltipplacement: "right" |
4. All default plugin settings.
01 |
$( "#myInput" ).masknumber({ |
21 |
tooltipplacement: "bottom" , |
22 |
tooltiptrigger: "hover" , |
23 |
bordercolorok: bordercolorok, |
24 |
bordercolornotok: "red" |
This awesome jQuery plugin is developed by alexander-perucci. For more Advanced Usages, please check the demo page or visit the official website.