title: Set combobox selected item from JavaScript
body: <p>I have JavaScript function which besides other stuff generates combobox option values. This combobox is by default hidden and it has empty option values. On certain page event this combobox is shown to the user with generated option values (0 to 5). Inside same function which generates those values I want to set combobox option value to be selected first from generated list, index 0. </p>
  
  <p>So I tried the following but nothing changes. Combobox has no selected item:</p>
  
  <pre><code>var myComboBox = $("#myCombo");
   for (i = 4; i &lt; checked; i++) {
       myComboBox.append('&lt;option value=' + i + '&gt;' + i + '&lt;/option&gt;');
   }
   myComboBox.selectedIndex = 0;
  </code></pre>