Alibabacloud.com offers a wide variety of articles about form validation example in jquery, easily find your form validation example in jquery information here online.
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:{
less than the set value, you can make a precise prompt.
Comparevalidator:The value range of the two form elements (numeric and numeric)
Regexvalidator:Validate the format of input values. You can write regular expressions by yourself, or use the regular expressions of the extension library.
Ajaxvalidator:Verify the value entered by the user on the server. For example, whether a user exists
Function
WordPress, of course, there are forms of verification, but we all know that the user experience is not good, the page jumps, and sometimes the form will be emptied, and the front desk form certification seems very necessary. The following is my written by changing the text box background color prompts the user input content, WordPress as long as the following code into the JS file can work. The
This article is mainly on the jquery plug-in easyui form validation submission of the sample code is introduced, the need for friends can come to the reference, I hope to help you. Code as follows: code as follows://Form Submit $ (' #myForm '). Form ({ NBSP;url: '/proce
jquery Practice Form Validation
Copy Code code as follows:
jquery Code
Copy Code code as follows:
$ (document). Ready (
function () {
$ ("#myform"). Submit (function () {
var username=$ ("#name"). Val ();
var age=$ ("#age"). Val ();
var sex=$ ("input[name = ' sex '][checked]"). Val ();
WordPress, of course, there are forms of verification, but we all know that the user experience is not good, the page jumps, and sometimes the form will be emptied, and the front desk form certification seems very necessary. The following is my written by changing the text box background color prompts the user input content, WordPress as long as the following code into the JS file can work. The
//Verify the information for the formvarMessage= "";functionValidate () {varLienceplate = document.getElementById ("Lienceplate");//License plate number varBar_code = document.getElementById ("Bar_code");//Vehicle Barcode varPhoneNumber = document.getElementById ("PhoneNumber");//Telephone varMobile =/^1[3458]\d{9}$/;//Phone number varLienceplatereg =/^[\u4e00-\u9fa5]{1}[a-z]{1}[a-za-z_0-9]{5}$/;//the regular of the car, the letter case can be varBar_codereg =/^[a-z]{2}[0-9]{8}$/;
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.