JQuery Form Validation

Source: Internet
Author: User

$ (). Ready (function () {
$ ("#empForm"). Validate ({
rules:{
Realname: "Required",
username:{
Required:true,
rangelength:[5,8]
},
psw:{
Required:true,
RANGELENGTH:[6,12]
},
psw2:{
Required:true,
RANGELENGTH:[6,12],
Equalto: "#psw"
},
Gender: "Required",
age:{
Required:true,
RANGE:[26,50]
},
Edu: "Required",
birthday:{
Required:true,
Dateiso: "Yyyy/mm/dd"
},
CheckBox1: "Required",
email:{
Required:true,
Email: "True"
},
cart:{
Required:true,
Cartlength:true,
Cartcheck:true
}
},
messages:{
Realname: "True name cannot be empty",
username:{
Required: "Login name cannot be empty",
Rangelength: "The length of the login should be between 5 and 8"
},
psw:{
Required: "Password cannot be empty",
Rangelength: "The length of the password should be between 6 and 12"
},
psw2:{
Required: "Password cannot be empty",
Rangelength: "The length of the password should be between 6 and 12",
Equalto: "Two times password input inconsistency"
},
Gender: "You do not have a third option",//If you are prompted to set its corresponding label label on the page, you can not set the relevant content in the information tip of the validation rule
age:{
Required: "Age cannot be empty",
Range: "Age must be between 26 and 50"
},
Edu: "Choose at least one degree",
birthday:{
Required: "Date of birth cannot be empty",
Dateiso: "Birth date format is incorrect"
},
email:{
Required: "Email cannot be empty",
Email: "The email address is not in the correct format"
},
cart:{
Required: "The ID number cannot be empty",
Cartlength: "The ID number is not the correct length",
Cartcheck: "The format of the identity card number is incorrect"
}
}
});
});

JQuery Form Validation

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.