Plug-in Overview: plug-ins are based on the core code of JQuery , writing a composite of certain specifications of the application. In other words, the plug-in is also jQuery code, through The introduction of JS files can be implanted.
There are many kinds of plug-ins, up to thousands of kinds, mainly can be divided into:UI class, forms and validation classes, input classes, special effects classes,Ajax class, sliding class, graphic image class, navigation class, comprehensive tools, animation and so on.
How do I refer to plugins?
The introduction of plug-ins requires a certain amount of steps, basically as follows:
1. The Jquery.js file must first be introduced and introduced before all plugins;
2. introduction of plugins;
3. introduce the peripheral of the plug-in, such as skin, Chinese bag, etc.
Plugin Note:
jQuery files must be introduced first
Then introduce the jQuery plugin file
Form verification Plugin Validate plug-in usage
How is it implemented?
Get the form, call the Validate (options) method to verify
The method receives the options option
{
Rules: {//set validation rules
Key:value
Key-the Name property value of the form element
Value-Validation rule name
},
Messages: {//Set error message
Key:value
Key-the Name property value of the form element
Value-Set error message
}
}
By customizing validation rules
$.validator.addmethod (Name,method,message)
* Name-Set the name of the custom validation rule
* Method-is a function
function (Value,element,param) {}
* Value-values of the element (validates the value of the current element)
* element-The elements themselves (validates the current element)
* param-parameters (value values in rules)
* Message-Set the error message for the custom validation rule
Common plugins under JQ