JQuery extension Validate 1 basic usage and package and download

Source: Internet
Author: User

They are:
<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. Basic usage: set verification rules through styles

Copy codeThe Code is 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"/>
<! -- This indicates that the email address is required and correct. -->
</P>
<P>
<Label for = "txtAge"> age </label>
<Input id = "txtAge" name = "txtAge" min = "18" max = "45"/>
<! -- The age must be between 18 and 45 -->
</P>

When a form is submitted, an error occurs if no email is entered or the email is incorrect, as shown below:

The default prompt after the text box indicates that jquery can be modified. validate. min. js. Search for and replace the style with Chinese. The style can be changed through the css class style, as shown in. required ,. email, etc. Of course, the class here can be separated by spaces among one or more items. The syntax format is the same as that of css. The options are as follows:

(1) required: required field for true
(2) remote: "check. php" uses ajax to call check. php to verify the input value.
(3) email: true: You must enter an email in the correct format.
(4) url: true must enter the url in the correct format
(5) date: true must be a date in the correct format
(6) dateISO: true: the date (ISO) in the correct format must be entered. For example, 2009-06-23,1998/01/22: only the format is verified and the validity is not verified.
(7) number: true: a valid number (negative number, decimal number) must be entered)
(8) digits: true must be an integer.
(9) creditcard: a valid credit card number must be entered.
(10) must to: "# field" the input value must be the same as # field
(11) accept: enter a string with a valid suffix (the suffix of the uploaded file)
(12) maxlength: A string with a maximum length of 5 characters)
(13) minlength: 10 string with a minimum input length of 10 (one character for Chinese characters)
(14) rangelength: [5, 10] The input length must be a string between 5 and 10. ") (a Chinese character is a single character)
(15) range: [5, 10] The input value must be between 5 and 10.
(16) max: 5 input value cannot be greater than 5
(17) min: 10 input value cannot be less than 10

Source code 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.