Jquery. validate (jquery. validate1.13.js), and jquery's validate

Source: Internet
Author: User

Jquery. validate (jquery. validate1.13.js), and jquery's validate

<Script src = ".. /js/jquery. js "> </script> <script src = ".. /js/jquery. validate. js "> </script> <script> $ (). ready (function () {$ ("# registerForm "). validate ();}); </script> <form id = "registerForm" method = "get" action = ""> <fieldset> <p> <label for = "cusername"> User Name </label> <input id = "cusername" name = "username" type = "text" data-rule-required = "true" data-rule-rangelength = "[2, 10]" data-msg -required = "username cannot be blank" data-msg-rangelength = "username must be 2 to 10 characters long"> </p> <label for = "cpassword "> password </label> <input id =" cpassword "name =" password "type =" password "data-rule-required =" true "data-rule-minlength =" 6 "data-msg-required =" the password cannot be blank "data-msg-minlength =" set at least six passwords "> </p> <label for =" cconfirmpassword "> Confirm password </label> <input id =" cconfirmpassword "name =" confirmpassword "type =" password "data-rule to =" # cpassword "data-msg- login to = "inconsistent passwords"> </p> <label for = "cemail"> email </label> <input id = "cemail" name =" email "data-rule-required =" true "data-rule-email =" true "data-msg-required =" email cannot be blank "data-msg-email =" email incorrect format "> </input> </p> <label for =" chasreferee "> select </label> <input type =" checkbox "if you have a recommender" id = "chasreferee" name = "hasreferee"> </p> <label for = "creferee"> recommender </label> <input id = "creferee" name = "referee" data-rule-required = "# chasreferee: checked "data-msg-required =" the recommender cannot be blank "> </input> </p> <input type =" submit "value =" submit "> </p> </fieldset> </form>

After reading the previous articles written by others, it seems that jquery is dependent. metadata. the js library is then written in the form of class = "required email". It seems a bit messy to write, and the class itself is rendered, it seems a bit messy to be attached with various validation rules. Fortunately, in the new version, there is a new writing method that does not rely on the above js library, it is simpler, more intuitive, and more powerful to redefine data-rule-validation rules and data-msg-prompts. The above test passed

My version of jquery. validate1.13.js

In this way, the message in the control does not take effect, and the following error occurs: Cannot read property 'call' of undefined garden contains many jquery. the validate article mentioned that it can be used. I think the version is outdated and I didn't try it out. In addition, I am also drunk when I unmount the verification class. The following test error is reported!

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <Html xmlns =" http://www.w3.org/1999/xhtml "> <Head> <meta http-equiv =" Content-Type "content =" text/html; charset = UTF-8 "/> <title> untitled document </title> <script type =" text/javascript "src =" jquery. min. js "> </script> <! -- <Script type = "text/javascript" src = "jquery. validate. js "> </script> --> <script type =" text/javascript "src =" jquery. validate1.13.js "> </script> <script type =" text/javascript "src =" jquery. validate. message_cn.js "> </script> <script type =" text/javascript "src =" jquery. metadata. js "> </script> <script type =" text/javascript "> $ (function () {$. metadata. setType ("attr", "validate"); $ ("# signupForm "). validate (); // $ ("# signupForm "). validate ({meta: "validate"}); // $ ("# commentForm "). validate ();}) </script> 

  

 

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.