Summary of $.extend methods in jquery

Source: Internet
Author: User


See in the original: Jquery.extend () function

The jquery extension method extend is a common method in the process of writing plugins, but it is often difficult to figure out the following two ways to write a relationship:

  1, $.extend (dest,src1,src2,src3 ...);

    Will Src1, SRC2, src3 ... Merging into Dest, DEST,SRC can be an array, an object, a function, and if the dest argument is omitted, then $.extend (SRC) can have only one parameter: SRC, at which point it is used to merge src into the object that invokes it, that is, to merge into the jquery global object.

2, $.fn.extend (SRC);

    This is the same as writing 1 omitted dest, but because its calling object is $.fn, its role is to merge src into the jquery instance.

3,$. Extend (BOOLEAN,DEST,SRC1,SRC2,SRC3 ...) ;

The first parameter, Boolean, indicates whether deep copies are made, and the remaining parameters are consistent with those described earlier;

The so-called deep merge refers to the SRC1,SRC2,SRC3 and other arrays or objects not only the parent merge, and the various children are also merged, if the item with the same name, then the item of the following parameter overrides the item of the preceding parameter, explained in detail see the Jquery.extend () function
    

Summary of $.extend methods in jquery

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.