001. Introducing the use of jquery validate

Source: Internet
Author: User
Tags valid email address

Refer to the jquery validation plugin's demo learning

Page Introduction jquery.js and Jquery.validate.js can;

<script src= ". /lib/jquery.js "></script>

<script src= ". /dist/jquery.validate.js "></script>

The language pack is introduced because the prompt information in the validation is in English

<script src= ". /dist/localization/messages_zh.js "></script>

The contents are as follows

(function (Factory) {
if (typeof define = = = "function" && define.amd) {
define (["jquery", ".. /jquery.validate "], factory);
} else if (typeof module = = = = "Object" && module.exports) {
Module.exports = Factory (Require ("jquery"));
} else {
Factory (JQuery);
}
} (function ($) {

/*
* Translated default messages for the JQuery validation plugin.
* LOCALE:ZH (Chinese, Chinese (zhōngwén), Chinese, Korean)
*/
$.extend ($.validator.messages, {
Required: "This is a required field",
Remote: "Please fix this field",
Email: "Please enter a valid email address",
URL: "Please enter a valid URL",
Date: "Please enter a valid date",
Dateiso: "Please enter a valid date (YYYY-MM-DD)",
Number: "Please enter a valid digit",
Digits: "Only enter Numbers",
CreditCard: "Please enter a valid credit card number",
Equalto: "Your input is not the same",
Extension: "Please enter a valid suffix",
MaxLength: $.validator.format ("You can enter a maximum of {0} characters"),
MinLength: $.validator.format ("minimum input {0} characters"),
Rangelength: $.validator.format ("Please enter a string of length between {0} and {1}"),
Range: $.validator.format ("Please enter a value between {0} and {1}"),
Max: $.validator.format ("Please enter a number not greater than {0}"),
Min: $.validator.format ("Please enter a number not less than {0}")
} );

}));

jquery knowledge too food, temporarily lazy to control the specific meaning, and Validate.js's head is the same.

The following is actually the validate.js in the $.validator of the messages changes, you can see inside the check field is the same, that is, the message is different.

001. Introduction of jquery Validate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.