title: How to select options in Multiple select list with jQuery?
body: <p>I have two dropdowns. When a user selects a value from the first one I want in the second (which has the multiple select option), with jQuery, to select some values automatically. How can I do that?</p>
  
  <pre><code>First select box:
  &lt;select id="update_carte_s" name="update_carte_s"&gt;
       &lt;option value="5!**8,9**!6!44.9"&gt;Ghid complet Internet&lt;/option&gt;
       &lt;option value="6!**6,7**!6!24.95"&gt;PC pas cu pas&lt;/option&gt;
       &lt;option value="7!**10**!3!27.95"&gt;Jocul ingerului&lt;/option&gt;
       &lt;option value="8!**11,12**!8!39"&gt;Ghidul vinurilor&lt;/option&gt;
  &lt;/select&gt;
  Second select box:
  &lt;select id="uc_autori_s" name="uc_autorilist[]" size="5" multiple&gt;
       &lt;option value="3"&gt;Rose Tremain&lt;/option&gt;
       &lt;option value="4"&gt;Jonathan Coe&lt;/option&gt;           
       &lt;option value="5"&gt;Cecilia Ahern&lt;/option&gt;
       &lt;option value="6"&gt;Marinel Serban&lt;/option&gt;
       &lt;option value="7"&gt;Emanuela Cherchez&lt;/option&gt;
       &lt;option value="8"&gt;Peter Buckley&lt;/option&gt;
       &lt;option value="9"&gt;Clark Duncan&lt;/option&gt;
       &lt;option value="10"&gt;Carlos-Ruiz Zafon&lt;/option&gt;
       &lt;option value="11"&gt;Catalin Paduraru&lt;/option&gt;
       &lt;option value="12"&gt;Dan-Silviu Boerescu&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The bolded values from the first select box split by <code>,</code> are the values that I want to select from the second select box. For example <code>11,12</code> would mean in the second box options with values 11 and 12 to be selected.</p>
  
  <p>Currently I have something like this:</p>
  
  <pre><code>$.bookAuthors = $.bookDetailsArray[1].split(',');
  $.each($.bookAuthors, function( intIndex, objValue ){
        $("#uc_autori_s").val(objValue).attr("selected","selected");
  });
  </code></pre>
  
  <p>but the problem is that only the last value is selected in my case 12 (selection of 11 is lost).</p>