jquery Form Validation Plugin tutorial

Source: Internet
Author: User
Tags jquery form validation

The first step, of course, is the same as using other jquery plug-ins, the introduction of plug-in file Vanadium.js;

The second step is to add the corresponding validation hooks to your form based on the validation method you want to use for your form. For example, you want to make the following form mandatory:

The code is as follows Copy Code
<input id= "Checkempty"/>
Then, add the class= ": Required" >:
<input id= "Checkempty" class= ": Required"/>

Others, like: Required verification hooks, can be found in the static page, such as the number is: The maximum value is: max_length;4, of course, you can also customize or modify the name you know.

If you have a form that satisfies multiple conditions, such as a required entry, and the number of characters entered between 4-8, you can write:

The code is as follows Copy Code

<label for= "checkmaxmin" > Input 4 to 8 characters: </label></td><td><input id= "Checkmaxmin": Required:min_length;4:max_length;8 "/>


Three steps, modify pop-up information, such as the item can not be empty, you feel that the personality, you can find this field in the judgment statement to change into what you feel personality.

The fourth step is to remove the criteria you cannot use. It is a virtue to keep the code clean and concise. The demo page lists all the methods of judgment that are almost impossible to use in the same form in real-world applications. So, delete those judgments you don't need. OK, that only proves that you are lazy and nothing else.

The fifth step, several parameter description:

Valid_class: ' rightformcss tutorial ',//when validation is correct the form style
Invalid_class: ' Failformcss ', the form style
Message_value_class when validation fails : ' Msgvaluecss ',//This style is the style of the call value in the pop-up message
Advice_class: ' failmsg ',//The style of the text message when validation fails

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.