Return to Snippet

Revision: 13461
at September 19, 2010 04:27 by gustavopaes


Updated Code
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]

Revision: 13460
at April 24, 2009 10:29 by gustavopaes


Initial Code
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]

Initial URL


Initial Description
Remove item (number or string) from array, using jQuery (method grep).

Initial Title
Remove item from array with jQuery

Initial Tags
array, jquery

Initial Language
JavaScript