jquery Form Validation plug-ins----Validate by associating fields with the Name property, changing the default prompts, officer the rules to the JS code

Source: Internet
Author: User
Tags jquery form validation

One, download the dependency package

NET disk Download: Https://yunpan.cn/cryvgGGAQ3DSW access password f224

Second, add a separate plugin jquery.validate.messages_cn. js.

Change the default prompt mode.

Third, jquery form validation plug-in----by the Name property to correlate fields to verify that Officer rules are written into the JS code.

<! 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 ({rules: {username : {required:true, minlength:2}, Email: {Required:true, Email:true}, URL:"url", Comment:"Required"        }      });  }); </script>  for= "Cusername" > Name </label> <em>*</em><input id= "cusername" name= "username" size= "/>" < /p> <p> <label for= "Cemail" > Email </label> <em>*</em><input id= "cemail" name= "email" size= "/>" </p> <p> <label for= "curl" > URL </label> <em> </em><input id= "curl" name= "url" size= "value="/> &LT;/P&G   T <p> <label for= "Ccomment" > Your comments </label> <em>*</em><textarea id= "ccomment" name= "comment" cols= "all" > </textarea> </p> <p> <input class= "Submit" type= "submit" value= "Submit"/> </p> </fi Eldset> </form> </body>

jquery Form Validation plug-ins----Validate by associating fields with the Name property, changing the default prompts, officer the rules to the JS code

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.