jQuery select dropdown and selectedq
<pre><code>   var colorID = 3;
   $('#color').each(function(){
   if($('#color').val() == colorID )
      $('#color').attr('selected');
   });
</code></pre>

<p>Why doesn't this work?</p>

<p>My html</p>

<pre><code>&lt;select id="color"&gt;&lt;option value=""&gt;Select Color&lt;/option&gt;
&lt;option value="1"&gt;Red&lt;/option&gt;
&lt;option value="2"&gt;Blue&lt;/option&gt;
&lt;option value="3"&gt;Black&lt;/option&gt;
&lt;option value="4"&gt;Purple&lt;/option&gt;
&lt;/select&gt;
</code></pre>
