Easy Tutorial
❮ Misc Callbacks Firewith Html Removeattr ❯

jQuery.merge() Method

jQuery Miscellaneous Methods

Example

Merge two arrays, modifying the content of the first parameter.

$(function () { 
    var arr = $.merge( [0,1,2], [2,3,4] );
    $("span").text(arr.join(", "));
})

Definition and Usage

The $.merge() function is used to merge the contents of two arrays into the first array.


Syntax

Parameter Description
first Array type The first array to merge, will contain the contents of the second array after merging
second Array type The second array to merge, this array will not be modified

More Examples

Merge Two Arrays

jQuery Miscellaneous Methods

❮ Misc Callbacks Firewith Html Removeattr ❯