jquery form Validation

Source: Internet
Author: User
Tags jquery form validation

//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}$/;//Vehicle Barcode    if(Lienceplate.value! = "") {        if(!lienceplatereg.test (Lienceplate.value)) {Message= "Plate number format error"; return false; }    }    Else{message= "License plate number cannot be empty"; return false; }       if(Bar_code.value! = "") {        if(!bar_codereg.test (Bar_code.value)) {Message= "Vehicle Barcode format Error"; return false; }    }    Else{message= "Vehicle barcode cannot be empty"; return false; }    if(Phonenumber.value! = "") {        if(!mobile.test (Phonenumber.value)) {Message= "Contact input format error"; return false; }    }    Else{message= "Contact cannot be empty"; return false; }    return true;}

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.