var s = $('select').serializeArray(), t = []; $.each(s,function(n,v){ t[t.length]=v.value; }); $('textarea').val(t.join('\n'));
Hi I understand maybe 40 percent of the above code. Can someone explain it? What does the brackets mean the [] <<<< brackets. And can someone tell me what is happening in the $.each(s,function(n,v) <<<<<<< what's happening here. also the t[t.length]=v.value; <<<< what is happening here. and finally the t.join \n is that adding a carriage return or something? Also, I tried to paste it into a script tag with the document ready stuff set and it didn't work I am running jQuery 1.2. Thasnk Frank On Sep 18, 2:16 am, Wizzud <[EMAIL PROTECTED]> wrote: > This will put all selects (just selected values, no names) into textarea... > var s = $('select').serializeArray(), t = []; > $.each(s,function(n,v){ t[t.length]=v.value; }); > $('textarea').val(t.join('\n')); > > FrankTudor wrote: > > > Hi all, > > > I am creating a little tool that has two multiple select boxes and > > then a text area. I need to figure out how to take the selected > > conets of one box, or the other, or both and pop them to the textarea. > > > If there are no examples can someone tell me what dom or events I need > > to be looking at? > > -- > View this message in > context:http://www.nabble.com/multiple-select-box-to-textarea-tf4469504s15494... > Sent from the JQuery mailing list archive at Nabble.com.