(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
Instance Demo:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>validate.js the use of built-in validation rules </title>
<script src= "Http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" ></script>
<script type= "Text/javascript" src= "Jquery.validate.js" ></script>
<body>
<form action= "" method= "Get" id= "tinyphp" >
<input type= "text" value= "" name= "UserName"/>
<input type= "Submit" value= "submitted"/>
</form>
<script type= "Text/javascript" >
$ ("#tinyphp"). Validate ({
Adding validation rules
Rules: {
username:{
Required:true,
Digits:true,
Username:true,
Rangelength: [5,10]
}
},
To reset the hint information
messages:{
UserName: {
Required: "Please fill in User name",
Digits: "Please enter an integer",
Rangelength: "User name must be between 5-10 characters"
}
}
});
</script>
</body>