jquery Plugins jquery Validate

Source: Internet
Author: User

Jquery Validate

I. What is jquery Validate:

The JQuery Validate plugin provides a powerful validation feature for your form.

Two. Common values:

1 Required:true The field that must be entered.
2 Remote: "check.php" Use the Ajax method to call check.php to validate the input values.
3 Email:true You must enter an e-mail message in the correct format.
4 Url:true You must enter a URL in the correct format.
5 Date:true You must enter a date in the correct format. Date Check IE6 error, use with caution.
6 Dateiso:true You must enter the correct format for the date (ISO), for example: 2009-06-23, 1998/01/22. Verify the format only and do not validate the validity.
7 Number:true You must enter a valid number (negative, fractional).
8 Digits:true You must enter an integer.
9 CreditCard You must enter a valid credit card number.
10 Equalto: "#field" The input value must be the same as #field.
11 Accept Enter a string with a valid suffix name (the suffix of the upload file).
12 Maxlength:5 Enter a string with a maximum length of 5 (Chinese characters are counted as one character).
13 Minlength:10 Enter a string with a minimum length of 10 (Chinese characters are counted as one character).
14 RANGELENGTH:[5,10] Enter a string that must be between 5 and 10 (Chinese characters are counted as one character).
15 RANGE:[5,10] The input value must be between 5 and 10.
16 Max:5 The input value cannot be greater than 5.
17 Min:10 The input value cannot be less than 10.

Three. Demo:

Html:

<Body>    <Div>        <formID= "Form1"Action="/"Method= "POST">            <inputtype= "text"name= "Name" /><BR/>            <inputID= "PWD"type= "text"name= "PWD" /><BR/>            <inputtype= "text"name= "PWD_OK" /><BR/>            <inputtype= "text"name= "Email" /><BR/>            <inputtype= "text"name= "Address" /><BR/>            <inputtype= "text"name= "Age" /><BR/>            <inputtype= "Submit"value= "Submit" />        </form>    </Div></Body>

Js:

<script type= "Text/javascript" >        $(function () {            $("#form1"). Validate ({rules: {Name: {required:true}, Email: {required:true, Email:true}, PWD: {required:true, digits:true, rangelength: [5, 10]}, PWD_OK: {required:true, digits:true, rangelength: [5, 10], Equalto:"#Pwd"}}, messages: {Name: {R Equired:"* Please enter a name"}, Email: {required:"* Mailbox cannot be empty", Email:"* Mailbox format is incorrect"                    }                }            })        }); </script>

Four. Download:

Novice Tutorials Provide CDN:

Http://static.runoob.com/download/jquery-validation-1.14.0.zip

If you are using the Visual Studio IDE, you can download it directly using the NuGet tool;

jquery Plugins 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.