title: Show form field based on select value in jquery
body: <p>I would like to display a div id based on the class of an initial select value. Ideally, all divs would be hidden initially, and only the div with the ID that matched the class of the select dropdown would be displayed. Thus, selection A or D below would both display div ID a.</p>
  
  <p>My current code looks like this:`</p>
  
  <pre><code>&lt;select name="milestone_tag" id="milestone_tag"
    &lt;option value="1" class="a"&gt;Selection A
    &lt;option value="2" class="b"&gt;Selection B&lt;/option&gt;
    &lt;option value="3" class="a-b"&gt;Selection C&lt;/option&gt;
    &lt;option value="4" class="a"&gt;Selection D&lt;/option&gt;
  &lt;/select&gt;
  &lt;div id="a"&gt;
    &lt;input name="milestone_a" /&gt;
  &lt;/div&gt;
  &lt;div id="b"&gt;
    &lt;input name="milestone_b" /&gt;
  &lt;div id="a-b"&gt;
    &lt;input name="milestone_a" /&gt;
    &lt;input name="milestone_b" /&gt;
  &lt;/div&gt;
  
  $('#milestone_tag').change(function() {
  $("#a,#b,#a-b").hide();
  $($(this).find('option:selected').attr('class')).show();
  });
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>