Home > Web Front-end > JS Tutorial > JQuery extension plug-in Validate 1 basic usage and package download_jquery

JQuery extension plug-in Validate 1 basic usage and package download_jquery

WBOY
Release: 2016-05-16 18:02:44
Original
1038 people have browsed it

They are:



1. Basic usage, set validation rules through styles

Copy code The code is as follows:














When the form is submitted, if the email is not filled in or the email is incorrect, an error will occur, as shown below:

The default prompt behind the text box can be modified jquery.validate.min.js to search and replace English with Chinese. The style can be changed through CSS class styles such as .required, .email, etc. Of course, the class here can be one or multiple items separated by spaces. The syntax format is the same as css. The optional items are:

(1)required:true required field
(2)remote:"check.php" Use The ajax method calls check.php to verify the input value
(3)email:true You must enter the email in the correct format
(4)url:true You must enter the URL in the correct format
(5)date:true Required Enter the date in the correct format
(6)dateISO:true You must enter the date in the correct format (ISO), for example: 2009-06-23, 1998/01/22 Only the format is verified, not the validity
(7 )number:true must enter a legal number (negative number, decimal)
(8)digits:true must enter an integer
(9)creditcard: must enter a legal credit card number
(10)equalTo:"# field" The input value must be the same as #field
(11)accept: Enter a string with a legal suffix (the suffix of the uploaded file)
(12)maxlength:5 Enter a string with a maximum length of 5 (Chinese characters Count as one character)
(13)minlength:10 Enter a string with a minimum length of 10 (Chinese characters count as one character)
(14)rangelength:[5,10] The input length must be between 5 and 10 String ") (Chinese characters count 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

Source code download

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template