Change selected dropdown by ID
<p>I've seen that you can change the selected dropdown item by value but I'd like to do it by the option ID because the values are created dynamically. I am creating a questionnaire with a dropdown menu, the section with questions, and a previous/next button. The values of the dropdown are dynamically created in a php array.</p>

<p>The way I have it set up is similar to this:</p>

<pre><code>&lt;select id="myDropdown"&gt;
    &lt;option id="1" value="dynamicallycreated1"&gt;&lt;/option&gt;
    &lt;option id="2" value="dynamicallycreated2"&gt;&lt;/option&gt;
    &lt;option id="3" value="dynamicallycreated3"&gt;&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>The select is created through php with the index of the array acting as the ID. There are previous/next buttons on the page to move back/forward from section to section. I want the dropdown to change to the appropriate item when the user clicks the next or previous button. I can easily grab the index through my current javascript so how can I change the dropdown using this index as the ID? Thanks!</p>
