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'))}) } ) });