jquery extension Validate 1 Basic usage and package download _jquery

Source: Internet
Author: User

respectively:
<script src= ". /contents/js/jquery-1.5.js "type=" Text/javascript "></script>
<script src= ". /contents/js/jquery.validate.min.js "type=" Text/javascript "></script>

1, the basic use of methods, through the style set up validation rules

Copy Code code as follows:

<script type= "Text/javascript" >
$ (function () {$ ("#signupForm"). Validate (); Verify the selected form
</script>

<p>
<label for= "Email" >Email</label>
<input id= "Email" name= "email" class= "required email"/>
<!--the entry indicates that the email address is required and is correct email-->
</p>
<p>
<label for= "Txtage" > Age </label>
<input id= "Txtage" name= "Txtage" min= "a" max= ""/>
<!--age is only between 18-45-->
</p>

When the form is submitted, if you do not fill out the email or the wrong email will be an error, as follows:

The default prompts at the back of the text box can modify Jquery.validate.min.js, find and replace English in Chinese, styles can be changed by CSS class style such as. Required,.email, of course, the class here can be separated by a space between one or more items, The syntax format is the same as CSS, and the items you can choose from are:

(1) Required:true must be lost field
(2) Remote: "check.php" use Ajax method to invoke check.php validate input value
(3) Email:true must enter the correct format email
(4) Url:true must enter the URL in the correct format
(5) Date:true must enter a date in the correct format
(6) Dateiso:true must enter the correct format of the date (ISO), for example: 2009-06-23, 1998/01/22 only verify the format, do not verify the validity
(7) Number:true must enter a valid number (negative, decimal)
(8) Digits:true must enter an integer
(9) CreditCard: Must enter the legal credit card number
(a) Equalto: "#field" input value must be the same as #field
(one) Accept: Enter a string with a valid suffix name (the suffix of the uploaded file)
(Maxlength:5) A string with a maximum of 5 input length (Chinese characters are counted as one character)
(Minlength:10) A string with a minimum input length of 10 (Chinese characters are counted as one character)
(rangelength:[5,10] Enter a string that must be between 5 and 10) (Chinese characters are counted as one character)
() range:[5,10] The input value must be between 5 and 10
() Max:5 input value cannot be greater than 5
(min:10) input value cannot be less than 10

SOURCE download

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.