On Apr 27, 12:21 pm, mkmanning <michaell...@gmail.com> wrote:
> Not sure why $.grep didn't work for you. Here's a functioning sample
> to compare:
>
> arr = $.grep(arr,function(n,i){
> return n.a1 != 1;
>
> })
>
> On Apr 27, 7:51 am, Mervyn <mervyn.mar...@gmail.com> wrote:
>
>
>
> > Hello all,
>
> > I have a question about removing an item from an array.
>
> > I am looking to remove an item from the array based on the property.
>
> > Ie.
> > arr = [{a1: 1, a2: 2},{a1: 3, a2: 4}, {a1: 5, a2: 6}]
>
> > remove first item from array because a1 = 1.
>
> > I am not entirely sure how to do this. I tried messing around with
> > grep a bit, but that didn't turn out well.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -
Monday, April 27, 2009
[jQuery] Re: Removing item from array based on property
Both methods worked perfectly. Thank you.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment