How to set all options to selected from multiple select boxes
<p>I have a jsp form in which the user is presented with multiple select boxes from which they can choose multiple options:</p>

<pre><code>&lt;td rowspan="4" colspan="1"&gt;Team Leaders&lt;br /&gt;
    &lt;form:select id="teamLeader" multiple="multiple" size="10" path="teamLeader"/&gt;
&lt;/td&gt;
&lt;td rowspan="4" colspan="1"&gt;HODs&lt;br /&gt;
    &lt;form:select id="teamHod" multiple="multiple" size="10" path="teamHod"/&gt;
&lt;/td&gt;
&lt;td rowspan="4" colspan="1"&gt;Directors&lt;br /&gt;
    &lt;form:select id="teamDir" multiple="multiple" size="10" path="teamDir"/&gt;
&lt;/td&gt;
&lt;td rowspan="4" colspan="1"&gt;Members&lt;br /&gt;
    &lt;form:select id="teamPersons" multiple="multiple" size="10" path="teamPersons"/&gt;
&lt;/td&gt;
</code></pre>

<p>When the user clicks save, I want all options from all select boxes to be set to selected. I can achieve this by using a little jQuery method for each select box as follows:</p>

<pre><code>jQuery(document).ready(function () {
    jQuery('#saveButton').click(function () {
        jQuery('#teamPersons').each(function () {
            jQuery('#teamPersons option').attr("selected", "selected");
        });
    });
});
</code></pre>

<p>However the problem is that I have to write a method for each of the 4 select boxes. Is there an easier way to do this i.e. write a single jQuery method to set all options to selected?</p>
