jQuery.extend () method
Examples
Through the array elements, and modify the first object
try it"
Definition and Usage
jQuery.extend () function is used to the contents of one or more objects into the target object.
Note: 1. If only for $ .extend () specifies a parameter, it means that the target parameter is omitted. In this case, target is the jQuery object itself. In this way, we can add a new global object jQuery function.
2. If multiple objects have the same property, which overrides the property value of the former.
grammar
Indicates whether the combined depth
Warning: do not support the first argument false.
参数 | 描述 |
---|---|
deep | 可选。 Boolean类型 指示是否深度合并对象,默认为false。如果该值为true,且多个对象的某个同名属性也都是对象,则该"属性对象"的属性也将进行合并。 |
target | Object类型 目标对象,其他对象的成员属性将被附加到该对象上。 |
object1 | 可选。 Object类型 第一个被合并的对象。 |
objectN | 可选。 Object类型 第N个被合并的对象。 |
More examples
Recursively merge the two objects
Recursively merge the two objects, and modifying the first object.
Merge defaults and options objects
Merge defaults and options object, and the object does not modify the defaults. This is a common plug-in development mode.