One, download the dependency package
NET disk Download: Https://yunpan.cn/cryvgGGAQ3DSW access password f224
Second, add another plugin jquery.metadata.js and write the check rule in the control.
Third, the need to rewrite the way the trigger check.
$ ("#commentForm"). Validate ({meta: "validate"});
Four, the detailed code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">; } label {width:10em;float: Left;} Label.error {float: none; color:red; Padding-left:. 5em; vertical-Align:top;} p {clear:both;}. Submit {margin-Left:12em;} Em {font-weight:bold; Padding-right:1em; vertical-align:top;}</style> <script type= "Text/javascript" >$ (document). Ready (function(){ $("#commentForm"). Validate ({meta: "validate")}); }); </script> for= "Cusername" > Name </label> <em>*</em><input id= "cusername" name= "username" size= "class=" { Validate:{required:true, Minlength:2}} "/> </p> <p> <label for= "Cemail" > Email </label> <em>*</em><input id= "cemail" name= "email" size= "class=" {Validate : {required:true, email:true}} "/> </p> <p> <label for= "curl" > URL </label> <em> </em><input id= "curl" name= "url" size= "" value= "" class= "{Valida Te:{url:true}} "/> </p> <p> <label for= "Ccomment" > Your comments </label> <em>*</em><textarea id= "ccomment" name= "comment" cols= "class=" {validate:{required:true}} "></textarea> </p> <p> <input class=" Submit "type=" Submit "Valu E= "Submit"/> </p> </fieldset> </form></body>Default Check rule:
(1) Required:truemust lose field (2) Remote: "check.php"Use the Ajax method call check.php to validate the input value (3) Email:trueYou must enter an email in the correct format (4) URL:trueYou must enter a URL in the correct format (5) Date:trueYou must enter the correct format for the date and date check IE6 error, use caution (6) Dateiso:trueYou must enter the correct format for the date (ISO), for example: 2009-06-23,1998/01/22validates the format only, does not validate the validity (7) Number:trueYou must enter a valid number (negative, fractional) (8) Digits:trueYou must enter an integer (9) CreditCard: You must enter a valid credit card number (Equalto: "#field"the input value must be the same as #field (11Accept: Enter a string with a legal suffix (the suffix of the upload file) (Maxlength:5)enter a string with a maximum length of 5 (Chinese characters are counted as one character) (MINLENGTH:10)enter a string with a minimum length of 10 (Chinese characters are counted as one character) (RANGELENGTH:[5,10] Enter a string with a length that must be between 5 and 10 "( Chinese character count) (5) range:[5,10] The input value must be between and 10 (+) Max:5 input value cannot be greater than 5 (+) Min:10 Input value cannot be less than ten
Default prompt:
messages: {required:"This field is required.", Remote:"Please fix this field.", Email:"Please enter a valid email address.", URL:"Please enter a valid URL.", Date:"Please enter a valid date.", Dateiso:"Please enter a valid date (ISO).", Datede:"Bitte geben Sie ein G eyebrow ltiges Datum ein.", Number:"Please enter a valid number.", Numberde:"Bitte geben Sie eine Nummer ein.", digits:"Please enter only digits", CreditCard:"Please enter a valid credit card number.", Equalto:"Please enter the same value again.", Accept:"Please enter a value with a valid extension.", MaxLength: $.validator.format ("Please enter no more than {0} characters."), minlength: $.validator.format ("Please enter at least {0} characters."), Rangelength: $.validator.format ("Please enter a value between {0} and {1} characters long."), Range: $.validator.format ("Please enter a value between {0} and {1}."), Max: $.validator.format ("Please enter a value of less than or equal to {0}."), min: $.validator.format ("Please enter a value of greater than or equal to {0}.")},
Five, as follows:
jquery Form Validation Plug-in----written to the control using Jquery.metadata.js officer rules