<span id="Label3"></p><p><p></p></p><p><p>jquery Plugin</p></p><p><p>jquery Plugin project hosted on github, project address https://github.com/jquery/plugins.jquery.com</p></p>jquery plug-in using form validation plugin<p style="padding-left: 2em;"><p style="padding-left: 2em;">Now the Web page form if there is no validation function, in the User's gnashing of teeth to fill out the endless form press the submit button moment, as a great front-end developers, the heart will be Condemned. Of course, There are many ways to verify forms, but validation as one of the best plugins, you have to use them, otherwise, do you have the nerve to brag? no, should I say you have a nerve? Can't brag yet!</p></p><p><p>jquery Validation plugin address jquery validation plugin download</p></p><p><p>Given the outrageous download speed, You can also go to the jquery validation plugin download</p></p><p><p>To believe in a word, practice is the only standard for testing truth. So go on!</p></p><pre class="brush:html;gutter:true;"><pre class="brush:html;gutter:true;"> </pre></pre><pre><pre><script src= ". /jquery-1.12.0.min.js "></script><br>Introduce jquery, don't ask me why<br><script src= "jquery.validate.min.js" ></script><br>Introduction of Validate plug-in, in the download File dist folder can be seen;</pre></pre><pre><pre><script><br> $ (function () {<br> $ ("#commentForm"). Validate ();<br>The Validate method is used for lowering the form object;<br> })<br></script></pre></pre><pre class="brush:html;gutter:true;"><br><div class= "code" > <form class= "cmxform" id= "commentform" method= "get" action= "#" > <FIELDSET&G T <legend> form </legend> <p> <label for= "cusername" > Name: </label> ; <input id= "cusername" name= "username" size= "" class= "required" minlength= "2"/>//note class and minlength, The values of these two properties required and 2 are prepared for the validate method, meaning required fields, longer than 2<br> </p> <p> <label for= "cemail" > Email </label> <input id= "cemail" name= "e-mail" size= "class=" and "required email" >//also pay attention to class properties, required ibid, email is of course Make sure It's a mailbox; </p> <p> <label for= "curl" > URL </labe l> <input id= "curl" name= "url" size= "class=" url "value=" ">//ibid. </ p> <p> <label for= "ccomment" > My comments:</label> <textarea id= "ccomment" name= comment "cols=" class= "required" ></textarea>//ibid </P&G T <p> <input class= "submit" type= "submit" value= "submission" > </p> </fieldset> </form> </div></pre><p><p>How concise, a few attributes to the form validation, so lazy really good, do not write regular really meet as a front-end development of the identity of the siege lion! In fact, I want to say is <strong>really good,</strong> the whole world is fresh and refined, but if you can write to the fly, please leave your contact information, we make friends good! )</p></p><p><p></p></p><p><p>Form verification results, But the egg, this is what I want to, as a Chinese people, you are sure that the back of the piece of useful; believe me, people can be trusted; our masters will not forget the language of the Chinese family with 1.4 billion citizens.</p></p><p><p>As long as the</p></p><pre class="brush:html;gutter:true;"><pre class="brush:html;gutter:true;"><script src= "jquery.validate.min.js" ></script></pre></pre><p><p>and then introduce</p></p><pre class="brush:html;gutter:true;"><pre class="brush:html;gutter:true;"><script src= "messages_zh.min.js" ></script></pre></pre><p><p>You'll find that you suddenly become confident Again.</p></p><p><p></p></p><p><p>wow, This is what, this is our people to see people love chinese, can confidently say to the boss, form verification just so;</p></p><p><p></p></p><strong><strong>now we can roughly make a certain function of the verification form, but as a proud front-end siege lion, The goal is the stars of the sea we will be so satisfied! </strong></strong><strong>the <strong>patient of forced cancer is extremely unbearable, a function of that point; life is precious, Jörn zaefferer, remember him, as the God who wrote and maintained validate, he saved your lives, and not our Lives. </strong></strong> <strong><strong>If the form is a control <label> used to trigger the cursor focus after clicking on the contents of the control, an ID will be set, so we just need to remember each ID that needs to be verified, happy to play in js, how willing to scribble on the HTML graffiti, will be Beaten. </strong></strong><pre class="brush:html;gutter:true;"><pre class="brush:html;gutter:true;">$ ("#signupForm"). Validate ({ rules: { }, messages: { } });</pre></pre><p><p>Forms Verify what we need, please speak out loud (rules and hints, roar)! So There's rules and messages! inside the Validate. There is no understanding of the meaning of the two words, please self-baidu!</p></p><p><p>(hey, advertising Baidu will give me money!)</p></p><p><p>Baidu: you're sure someone is watching! You have a Nerve.</p></p><p><p>...</p></p><p><p>)</p></p>then, It was time to fill in the rules, how to write the rules! remember, everything is an object, everything is an object, everything is not the end of the object! pro, is the object of ouch!<pre class="brush:html;gutter:true;">$ ("#signupForm"). Validate ({rules: {firstname: "required", lastname: "required", username: {required:true, Minlength:2 }, password: {required:true, Minlength: 5}, confirm_password: {required:true, minlength:5, equalto: "#password"}, Email: { required:true, email:true}, Topic: { Required: "#newsletter: checked", minlength:2}, Agree: "required"}, messages: {firstname: "please Enter your name", Lastname: "please Enter your last name", Username: {required: "please Enter user name", minlength: "user name must consist of two letters "}, password: {required:" Please enter password ", mi Nlength: "password length cannot be less than 5 letters"}, confirm_password: {required: "please Enter password ", minlength:" password length cannot be less than 5 letters ", equalto:" two times password input inconsistent " }, email: "please Enter a correct mailbox", agree: "please accept our statement", topic: "please select two themes" } });</pre><p><p> <strong>Rules are objects 1,key/value are id/object 2! Value is also an object of the key/value, so what does this object mean in 2? Please look at the previous article!</strong></p></p><p><p> <strong>Messages is also an object 1,key/value is Id/object 2, within object 2, The value is the prompt message, and the Rules object 2 of Rule one by one corresponds.</strong></p></p><p><p>Isn't it very clear that the whole world is feeling clear?</p></p><p><p>In fact, I want to say is, off duty, walk up!</p></p><style><style><!--.validation-box{ padding-left:2em; }--></style></style><p><p>Sharp Jquery-validation.</p></p></span>
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