The JQuery Validate plug-in provides a powerful validation feature for forms, making client form validation simpler, while providing a wide range of customization options to meet the needs of the application. The plug-in bundles a set of useful authentication methods, including URL and email authentication, while providing an API for writing user-defined methods. All bundled methods use English as an error message by default and are translated into 37 other languages.
The plugin is written and maintained by Jörn Zaefferer, a member of the jquery team, the main developer of the jquery UI team, and a qunit maintenance person. The plugin began appearing early in 2006 in JQuery and has been updated ever since. The current version is 1.14.0.
Visit the jquery Validate website and download the latest version of the jquery Validate plugin.
<script src= "Http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js" ></script>
<script src= "Http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js" ></ Script>
default checksum rule
Serial Number |
rules |
Description |
1 |
Required:true |
The field that must be entered. |
2 |
Remote: "check.php" |
Use the Ajax method to invoke check.php to validate input values. |
3 |
Email:true |
You must enter an e-mail message in the correct format. |
4 |
Url:true |
You must enter a URL in the correct format. |
5 |
Date:true |
You must enter a date in the correct format. Date Check IE6 error, use caution. |
6 |
Dateiso:true |
You must enter a date in the correct format (ISO), for example: 2009-06-23, 1998/01/22. Verify the format only, not validate the validity. |
7 |
Number:true |
You must enter a valid number (negative, decimal). |
8 |
Digits:true |
You must enter an integer. |
9 |
CreditCard |
You must enter a valid credit card number. |
10 |
Equalto: "#field" |
Input values must be the same as #field. |
11 |
Accept |
Enter a string with the legal suffix name (the suffix of the uploaded file). |
12 |
Maxlength:5 |
Enter a string with a maximum length of 5 (Chinese characters are counted as one character). |
13 |
Minlength:10 |
Enter a string with a minimum length of 10 (Chinese characters are counted as one character). |
14 |
RANGELENGTH:[5,10] |
Enter a string that must be between 5 and 10 (Chinese characters are counted as one character). |
15 |
RANGE:[5,10] |
The input value must be between 5 and 10. |
16 |
Max:5 |
The input value cannot be greater than 5. |
17 |
Min:10 |
The input value cannot be less than 10. |
Default Hints
Messages: { required: ' This field is required. ', remote: ' Please fix This field. ', email: ' Please enter an valid email address. ', url: "Please Enter a valid URL. ", date:" Please enter a valid date. ", dateiso:" Enter a valid date (ISO). ", number:" Please enter a valid number. ", dig Its: ' Please enter only digits. ', creditcard: "Please enter a valid credit card number.", &NBSP;&N Bsp; equalto: "Please enter the same value again.", maxlength: $.validator.format (" Please enter no further than {0} characters. "), minlength: $.validator.format (" Please enter at LEAs t {0} characters. "), rangelength: $.validator.format (" Please enter a value between {0} and {1} c " Haracters long. "), &NBSP;&NBSP;&NBsp; range: $.validator.format ("Please enter a value between {0} and {1}."), max: $.validat Or.format ("Please enter a value less than or equal to {0}."), min: $.validator.format ("Please E
Nter a value greater than or equal to {0}. ") }
The JQuery validate provides a Chinese message pack, located in the dist/localization/messages_zh.js of the download package, which reads as follows:
(function (Factory) {
if (typeof define = = "function" && define.amd) {
define (["jquery", ".. /jquery.validate "], factory);
else {
factory (jQuery);
}
(function ($) {/
* Translated default messages for the JQuery validation plugin.
* LOCALE:ZH (Chinese, Chinese (zhōngwén), Chinese, Hans) * *