<p>Using <a href="http://en.wikipedia.org/wiki/JQuery" rel="noreferrer">jQuery</a>, how can I dynamically set the size attribute of a select box?</p>

<p>I would like to include it in this code:</p>

<pre><code>$("#mySelect").bind("click",
    function() {
        $("#myOtherSelect").children().remove();
        var options = '' ;
        for (var i = 0; i &lt; myArray[this.value].length; i++) {
            options += '&lt;option value="' + myArray[this.value][i] + '"&gt;' + myArray[this.value][i] + '&lt;/option&gt;';
        }
        $("#myOtherSelect").html(options).attr [... use myArray[this.value].length here ...];
    });
});
</code></pre>

Oops, it's
```
```
$('#mySelect').attr('size', value)
```
```