Learn about jquery Validate.js No more headaches for regular verification

Source: Internet
Author: User

The JQuery Validate is a feature-rich, regular validation plug-in that provides the client with powerful authentication capabilities while providing a number of regular options to meet the needs of the application. The plug-in bundles a set of useful authentication methods, including URL verification and email authentication, to provide a more convenient user experience for the client.

It is easier to understand by example.

1   //Defining validation Rules2 rules:{3UserName: {required:true, rangelength:[2,10]},//True indicates a minimum of 2 maximum of 10 restricted characters required4Email: {Required:true, Email:true },5Password: {required:true, Minlength:6},//minimum of 6 characters6 Confirm_password: {7Requiredtrue,8Minlength:5, 9Equalto: "#password"},//Determine if the password is consistentTenAge:{required:true, range:[15,40]}//min 15 max 40 Internal value One}

Define regular rules and prompt for information to improve the user experience.

1 //Custom Prompt Message2 messages:{3 userName: {4Required: "Please enter user name",5Rangelength: "The length of the user name is between 2 and 10" },6 Email: {7Required: "Please enter your email address", 8Email: "Please enter the correct email address" },9 Password: {TenRequired: "Please enter your password", OneMinlength:jQuery.format ("Password cannot be less than {0} characters") }, A Confirm_password: { -Required: "Please enter the confirmation password", -MinLength: "Confirm password cannot be less than 6 characters",  theEqualto: "Two times input password inconsistent" }, - age:{ -Required: "Please enter your age", -Range: "Between the ages of 15 and 40 years old" +                 } -}

Learn about jquery Validate.js No more headaches for regular verification

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.