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