Using jQuery, how can I dynamically set the size attribute of a select box?
I would like to include it in this code:
$(\"#mySelect\").bind(\"click\",
$("#mySelect").bind("click", function(){
$("#myOtherSelect").children().remove();
var myArray = [ "value1", "value2", "value3" ];
for (var i = 0; i < myArray.length; i++) {
$("#myOtherSelect").append( '<option value="' + myArray[i] + '">' + myArray[i] + '</option>' );
}
$("#myOtherSelect").attr( "size", myArray.length );
});
Oops, it's
$('#mySelect').attr('size', value)