<!DOCTYPE HTML><HTML> <Head> <Metahttp-equiv= "Content-type"content= "text/html; Charset=ansi"/> <title>Validation2</title> <Scriptsrc=".. /scripts/jquery-2.1.3.js "></Script> <Scriptsrc=".. /scripts/jquery.metadata.js "type= "Text/javascript"></Script> <Scriptsrc=".. /scripts/jquery.validate.js "type= "Text/javascript"></Script> <Scripttype= "Text/javascript"> $(function(){ $("#commentForm"). Validate ({meta:"Validate" }); }); </Script> <styletype= "Text/css"> *{font-family:Verdana;font-size:96%;}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> </Head> <Body> <formclass= "Cmxform"ID= "Commentform"Method= "Get"Action="#"> <fieldset> <legend>A simple example of verifying a comment with a validation hint</legend> <P> <label for= "Cusername">Name</label><em>*</em> <inputID= "Cusername"name= "username"size= "+"class= "{validate: {required:true,minlength:2}}" /> </P> <P> <label for= "Cemail">Email</label><em>*</em> <inputID= "Cemail"name= "Email"size= "+"class= "{validate:{required:true,email:true}}" /> </P> <P> <label for= "Curl">Url</label><em> </em> <inputID= "Curl"name= "url"size= "+"value=""class= "{validate:{url:true}}" /> </P> <P> <label for= "Ccoment">Your comments</label><em>*</em> <textareaID= "Ccoment"name= "comment"cols= "All"class= "{validate:{required:true}}"></textarea> </P> <P> <inputclass= "Submit"type= "Submit"value= "Submit"/> </P> </fieldset> </form> </Body></HTML>
I JS rookie, today according to book Code, with Jquery.metadata.js to verify, the result has failed. Debugging several times, the code is also checked for consistency, and the discovery is still unsuccessful. After the great god instruction debugging, finally found the problem. It turns out to be rules
"Space"Breaking the curse, when the rule is to be separated by a space, so the rule is not found. Modify the following: And then the result can be out: it seems to take a good look at the source
"JQuery" Jquery.metadata.js validation invalidation