Dylan,
That's a nice workaround, to just pass the selected value. But I think
Diddly needs to add all the values in #foo2.

Diddly,
I think you mistype this, shouldn't it be type="hidden"?
<input type="text" id="foo2" />


On 9/11/07, Dylan Verheul <[EMAIL PROTECTED]> wrote:
>
>
> Try this:
>
> $('#theButton2').click(function() {
>    $("#foo2").val($("#foo").val().toString());
> });
>
> You catch the click event.
> You set the value of the text box to the value of the select
> (converted to a string).
>
> -Dylan
>
> On 9/10/07, Diddly Doo <[EMAIL PROTECTED]> wrote:
> >
> > I've some HTML as below. I'm trying to work out a function to transfer
> > the values in the listbox to the text box. So, the value of the hidden
> > box would be 1,2,3
> >
> > <select id="foo" multiple="multiple" size="6">
> > <option value="1">Item 1</option>
> >             <option value="2">Item 2</option>
> >             <option value="3">Item 3</option>
> >          </select>
> > <input type="text" id="foo2" />
> > <input type="button" id="theButton2" value="Test" />
> >
> > This is what I've got so far, not quite right though.
> >
> > $(function() {
> >         $('#theButton2').click(
> >                 function() {
> >                         $.each($("option",$('#foo')),function(i,n)
> {$('#foo2').append($
> > (n).attr('value'))})
> >                 }
> >         )
> > });
> >
> >
>



-- 
Joan Piedra  ||  Frontend web developer
http://www.justaquit.com/  ||  http://www.joanpiedra.com/

Reply via email to