Jquery extension method summary

Source: Internet
Author: User

I. Method list:
1. jQuery. extend (Object); // jQuery Extension Method
2. jQuery. fn. extent (Object); // jQuery selected Object Extension Method
Ii. Call example:
1. An example of jQuery extension method is as follows: Copy codeThe Code is as follows: jQuery. extend ({
Meg: function (message ){
Alert (message );
},
MegToo: function (messageToo ){
Alert (messageToo );
}
});

Page call: jQuery. Meg ("Hi, Stone ");
Meg and MegToo are my jQuery custom extension methods. Multiple extension methods are separated by commas.
2. There are two writing methods for the extended object selected by jQuery.
A) Example of jQuery's object extension method is as follows:Copy codeThe Code is as follows: jQuery. fn. extend ({
ShowHtml: function (showhtml ){
JQuery(this).html (showhtml );
}
});

Page call: jQuery ("# htmlDiv"). ShowHtml ("Stone, Hi! ");
ShowHtml is the extension method for the objects selected by jQuery. Multiple extension methods are separated by commas.
B) Example 2 of jQuery's object extension method is as follows:Copy codeThe Code is as follows: (function (jq ){
Jq. fn. ShowHtmlToo = function (showhtml ){
JQuery(this).html (showhtml );
};
}) (JQuery)

Same call Method 1: jQuery ("# htmlDiv"). ShowHtmlToo ("Stone, Hi! ");
Stone preparation]

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.