Long time no write the content of the jquery source.The development of jquery is a big factor because it is very easy to expand, and the reason is that it benefits from the Extend functionThe function is an extension function ... is an extended function, which is actually a shallow copy and a deep copy function.The function is really powerful, and it's very elegant to write.Take a look at the usage first, there are three ways to use it.
T
In addition to using the $.extend Extension tool function, you can extend the original object, and when Object the object is extended, two objects are merged, and when the same property name exists, the latter overrides the former, and the calling format is:$.extend (obj1,obj2,…objN);The parameters obj1 through OBJN represent the various original objects that nee
JQuery customizes jQuery. extend () and jQuery. fn. extend () method. jQuery. the extend () method can create global functions or selectors, whereas jQuery. fn. the extend () method can create jQuery object methods. the two methods use the same code. One is used to merge attributes and methods for jQuery objects or com
JQuery customizes jQuery. extend () and jQuery. fn. extend () method. jQuery. the extend () method can create global functions or selectors, whereas jQuery. fn. the extend () method can create jQuery object methods. the two methods use the same code. one is used to merge attributes and methods for jQuery objects or com
JQuery. fn. extend (object); the extension to jQuery. prototype is to add "member functions" to the jQuery class ". JQuery class instances can use this "member function ". JQuery provides two methods for development plug-ins:
The Code is as follows:
JQuery. fn. extend (object );JQuery. extend (object );
JQuery. extend
Jquery provides two methods for development plug-ins: Jquery. FN. Extend (object ); Jquery. Extend (object ); Jquery. Extend (object); adds a new method to the class to extend the jquery class itself. Jquery. FN. Extend (object); add a method to the jquery object. Wh
People who have extended jQuery or created jQuery plug-ins may be familiar with these two methods.JQuery. extend ([deep], target, object1, object2... [objectN])JQuery. fn. extend ([deep], target, object1, object2... [objectN])Both attributes are used to merge the attributes of two or more objects to the target object.Deep is a Boolean value, indicating whether to perform deep merge. The default value is fal
This article briefly describes the concepts and differences between jquery. fn. extend and jquery. extend. it is very practical. if you need it, you can refer to it. 1. jquery. extend (object); add a new method for the class to extend the jQuery class itself.
Jquery. fn. extend
This article briefly describes the concepts and differences between jquery. fn. extend and jquery. extend. It is very practical. If you need it, you can refer to it. 1. jquery. extend (object); add a new method for the class to extend the jQuery class itself.
Jquery. fn. extend
methods for developing plug-ins using JQ:1, Jquery.extend ();2, JQuery.fn.extend ();3 . Created by $.widget () by using the part factory method of the JQuery UI. Because the third way is usually used to develop more advanced jquery parts, the development is more difficult, so the first and second way to use the more extensive, the following mainly on the first two ways of difference and contact and the method used to do some introduction.A brief explanation: jquery is a very good class for enca
Introduction to the $. extend method in jQuery to extend the JSON object, jqueryjson
$. Extend can be used to extend a JSON object. One or more other objects can be used to expand an object and return the extended object.
Example 1
Merge settings and options, modify and return settings
Var settings = {validate: fal
Deep is a Boolean value, indicating whether to perform deep merge. The default value is false. deep merge is not executed.In this way, you can add new attributes and methods on jQuery or jQuery. fn. Most of the other modules of jQuery are implemented in this way.
$. Extend () is used to add extensions to jQuery ()For example: jQuery. extend ({add: function (a, B) {return a + B }})
Use: $. add (1, 3) ===> 4;
$. Data Applications under $. extend and $. fn,. extend. fn
1. First, we will study $. data
1) code snippet
Note: add the data-name attribute to the tag to call the value of the variable named after data-in $. data.
2) connection code, $. data Usage in $. fn
$. Extend ($. fn ,{
ShowAge: function (){Console. log (this [0]. dataset. age );}});
$ ("# Test"). sho
jquery's Extend extension method:The extended method of jquery extend is a common method in the process of writing plug-ins, there are some overloaded prototypes, here we go to understand.One, jquery extension method prototype is:
Extend (dest,src1,src2,src3 ...);
It means to src1,src2,src3 ... Merged into Dest, the return value is the merged dest, which show
In jquery, extend actually do plug-in when still use more, today at the same time summary jquery and Ext JS
Extend usage, first look at jquery.
1) Extend (dest,src1,src2,src3 ...);
Copy Code code as follows:
var start = {
Id:123,
COUNT:41,
Desc: ' This is information ',
Title: ' Base Object ',
Tag: ' Uncategorized ',
Values: [1,1,2,3,5
The $.extend () method in Jquery is used to implement merging properties of multiple objects into the first object.$.extend (Object1, [object2]);Merges the properties from the latter two objects, Object1 and Object2, into Object1, which by default is a merge overwrite operation without iteration.At this point object1 copy of the object2 is a shallow copy (a common entity, only the reference variable)Simple
The following is their own understanding, welcome to learn from the small partners to correct, thank you thank you1.jquery.fn.extend (object): Commonly used to make pluginsOfficial explanation: A jquery plugin is simply a new method, which we use to extend JQuery ' s prototype object. (A new simple jquery plugin that we used to extend the jquery prototype object)As soon as you see the extended prototype obj
jquery has two methods for developing plug-ins, namely:JQuery.fn.extend (object);Jquery.extend (object);Jquery.extend (object); To extend the jquery class itself. Adds a new method to the class.JQuery.fn.extend (object); Adds a method to a jquery object.As an example,[HTML]View PlainCopy
h3 class="Ye">new soulh3>
h3 class="Ye">new soulh3>
h3 class="Ye">new soulh3>
h3 class="Ye">new soulh3>
script type="Text/javascr
The Extend extension method prototype in jquery is: 1, Extend (dest,src1,src2,src3 ...);It means to src1,src2,src3 ... Merged into Dest, the return value is the merged dest, which shows that the method is modified to dest structure after merging. If you want to get the results of a merge but do not want to modify the structure of the dest, you can use the following:2, Var newsrc=$.
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.