Common plug-ins in JQ and common plug-ins in JQ
Plug-in overview: The plug-in is based on jQuery's core code and compiled into a composite and standardized application. That is to say, the plug-in is also jQuery code, which can be embedded by introducing js files.
There are many types of plug-ins, which can be roughly divided: UI class, form and verification class, input class, special effect class, Ajax class, slide class, graphic image class, navigation class, integrated tool class, animation class, etc.
How can I reference a plug-in?
Some steps are required to introduce the plug-in:
1. The jquery. js file must be introduced before all plug-ins;
2. Introduce the plug-in;
3. Introduce the plug-in perimeter, such as skin and Chinese package.
Plugin note:
The jQuery file must be introduced first.
Introduce the jQuery plug-in file
Use of Form validation plug-in Validate
How to implement it?
Obtain the form and call the validate (options) method for verification.
Options for receiving this method
{
Rules: {// set verification rules
Key: value
Key-form element name Attribute Value
Value-verification rule name
},
Messages: {// set the error message
Key: value
Key-form element name Attribute Value
Value-set error message
}
}
Customize verification rules
$. Validator. addMethod (name, method, message)
* Name-set the name of the custom verification rule
* Method-is a function.
Function (value, element, param ){}
* Value-element value (verify the value of the current element)
* Element-element itself (verify the current element)
* Param-parameter (value in rules)
* Message-set error messages for custom verification rules