/ Published in: JavaScript

Remove item (number or string) from array, using jQuery (method grep).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
arr = [1, 2, 3, 4, 5] // array inicial var removeItem = 2; // item do array que deverá ser removido arr = jQuery.grep(arr, function(value) { return value != removeItem; }); // new array // [1, 3, 4, 5]
Comments
