Common plug-ins in JQ and common plug-ins in JQ

Source: Internet
Author: User

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

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.