how to change a selections options based on another select option selected?
<p>here is my html.</p>

<pre><code>&lt;select id="type"&gt;
&lt;option value="item1"&gt;item1&lt;/option&gt;
&lt;option value="item2"&gt;item2&lt;/option&gt;
&lt;option value="item3"&gt;item3&lt;/option&gt;
&lt;/select&gt;

&lt;select id="size"&gt;
&lt;option value=""&gt;-- select one -- &lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>here is the jquery i tried but was unsuccessful.</p>

<pre><code>$(document).ready(function() {

if( $("#type").val("item1"))
{
  $("#size").html("&lt;option value='test'&gt;test&lt;/option&gt;&lt;option value="test2"&gt;test2&lt;/option&gt;);
}
elseif( $("#type").val("item2"))
{
   $("#size").html("&lt;option value='anothertest1'&gt;anothertest1&lt;/option&gt;");
}

});
</code></pre>

<p>basically what i'm trying to do is if an option is selected in #type then the size select is populated with options associated to it. how can i do this?</p>

<p>thanks</p>
