[jQuery] Re: Check value when adding to array

2009-04-15 Thread mkmanning
$.map creates a new array based on the return value of the function, using the format newarray = $.map( array, function ); The array in the sample is the jQuery selector (which is array-like). The function iterates through the members of the array, with the index passed in as "i" and the member e

[jQuery] Re: Check value when adding to array

2009-04-13 Thread mkmanning
If I understand you code, you're trying to create an array of name=value, with value being specifically set if the name has _test in it? var arr = $.map($('input'),function(n,i){ return n.name+'='+(n.name.indexOf('_test')!=-1?'some_value':n.value); }); On Apr 13, 5:27 pm, Nic Hubbard wr

[jQuery] Re: Check value when adding to array

2009-04-13 Thread Nic Hubbard
Could you explain this one a little more? How you coded it is a little confusing to me. On Apr 13, 6:34 pm, mkmanning wrote: > If I understand you code, you're trying to create an array of > name=value, with value being specifically set if the name has _test in > it? > > var arr = $.map($('inpu

[jQuery] Re: Check value when adding to array

2009-04-13 Thread Steven Yang
try remove the single quotes if ($("input[name*=delete_linkid]",this)) { alert('it does!');

[jQuery] Re: Check value when adding to array

2009-04-13 Thread Nic Hubbard
Tried the following, but did not seem to work: if ($("input[name*='delete_linkid']",this)) { alert('it does!'); } On Apr 13, 5:27 pm, Nic Hubbard wrote: > I have input values that I am adding to a array.  I would like to be > able to check if any of them end in _test and if so, I need to set