add to array jquery code example
Example 1: jquery add element to array
var ids = [];
$(document).ready(function($) {
var $div = $("").appendTo(document.body), code;
$(".color_cell").each(function() {
code = $(this).attr('id');
ids.push(code);
$div.append(code + "
");
});
});
Example 2: js push array
array.push(element_to_push);
Example 3: add val to array jquery
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");