title: Codeigniter populate multiselect with selected values using jQuery/JavaScript
body: <p>I have a multiselect in one of my Modals that I would like to populate using jQuery/JavaScript created with the code below:</p>
  
  <pre><code>&lt;select multiple class="selectpicker display-block" data-width="100%" name="non-compatibility[]" id="non-compatibility" title='&lt;?php echo _l('invoice_suboption_noncompatible'); ?&gt;'&gt;
                              &lt;option value=""&gt;&lt;/option&gt;
                              &lt;?php foreach($suboptions as $suboption){ ?&gt;
                              &lt;option value="&lt;?php echo $suboption['plat_option'].','.$suboption['name']; ?&gt;" data-subtext="&lt;?php echo $suboption['plat_option']; ?&gt;"&gt;&lt;?php echo $suboption['name']; ?&gt;&lt;/option&gt;
                              &lt;?php } ?&gt;
                          &lt;/select&gt;
  </code></pre>
  
  <p>The values look like RAM,4GB and HardDrive,1TB. I would like to set the selected values for the multiselect using jQuery/JavaScript but I'm having a hard time. I thought the below would work but it doesn't. <code>$('select[name="non-compatibility[]"]').val('RAM,4GB');</code></p>
  
  <p>Any clues what might be going on or how to do this successfully? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I noticed That when I pick another option in the select manually it then shows the ones I set to selected. Is there some way that I have to refresh the select in order to show the change?</p>