Number Input Validation jQuery - Download Easy Number Input Validation Plugin For jQuery - numberValidation

Download Easy Number Input Validation Plugin For jQuery – numberValidation

Posted on

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.

Number Input Validation jQuery - Download Easy Number Input Validation Plugin For jQuery - numberValidation

File Size: 15.2 KB
Views Total: 5073
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

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({
02  
03   // apply multiple rules to the input field
04   rules:{
05     type:'integer',
06     required:true,
07     minvalue:-3,
08     maxvalue:100
09   },
10  
11   // custom error messages
12   messages:{
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"
17   },
18  
19   // error <a href="https://www.jqueryscript.net/tags.php?/popup/">popup</a> settings
20   settingserror:{
21     tooltipplacement:"right"
22   }
23    
24 });

4. All default plugin settings.

01 $("#myInput").masknumber({
02  
03   rules: {
04       type: 'integer',
05       required: false,
06       maxvalue: undefined,
07       minvalue: undefined,
08       decimals: undefined,
09       length: undefined
10   },
11   messages: {
12       type: "",
13       required: "",
14       maxvalue: "",
15       minvalue: "",
16       decimals: "",
17       length: ""
18   },
19   settingserror: {
20       setting:true,
21       tooltipplacement: "bottom",
22       tooltiptrigger: "hover",
23       bordercolorok: bordercolorok,
24       bordercolornotok: "red"
25   }
26    
27 });

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

source : jqueryscript.net