title: JQuery to change value based on selection in a drop down menu
body: <p>Using JQuery I'm trying to create a drop-down menu and then change a certain value on a search input element based on what people select in the menu.</p>
  
  <p>So far I've figured out how to target the value I need to change. I've also gotten as far as having it so that if someone makes <strong>any</strong> selection from the menu, it changes the search input value to one specific value:</p>
  
  <pre><code>&lt;div&gt; 
   &lt;form action="setColor" method="post"&gt;
     &lt;fieldset&gt;
       &lt;label for="color"&gt;Select A Color&lt;/label&gt;
         &lt;select name="color" id="color"&gt;
             &lt;option&gt;Blue&lt;/option&gt;
             &lt;option selected="selected"&gt;Red&lt;/option&gt;
             &lt;option&gt;Yellow&lt;/option&gt;
        &lt;/select&gt;
     &lt;/fieldset&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  
  
  &lt;script&gt; 
  
    $(function() { 
     $('select[name="color"]').change(function() {
       $('input[name="ancestorId"]').val("9999");
     });
   });
  
  &lt;/script&gt; 
  </code></pre>
  
  <p>What I need now is something that sets the value according to the menu selection, matched up something like this:</p>
  
  <pre><code>Blue = 9999
  Red =  8888
  Yellow = 7777 
  </code></pre>
  
  <p>I'm still looking at examples and will keep trying, but kind of stuck. Any advice appreciated.</p>