title: Defining hidden field value based on select box selection
body: <p>Is there a jQuery way to using the "starts with" from the SELECT box to pass a variable to a hidden field? Here's what I have for the script to far, but I need it to only look for the first letter, really. </p>
  
  <p>For example, if the user selects "Keyboards - Acoustic Piano", we need "KeyboardMag" to pass through in the hidden field "referralCode". Here's what I have so far:</p>
  
  <pre><code>$( document ).ready(function() {
  var refcode={
        Guitars     : "GuitarsMag",
        Keyboards   : "KeyboardMag",
        Drums       : "DrumMag",
        Microphones : "MusicMag"
  }
  $("#productsMusical").change(function(e){ 
        $('[name="referralCode"]').val(  refcode[ $(this).val() ] )
  })
  });
  
  &lt;input name="referralCode" value="" id="referralCode" type="hidden"&gt;
  
  &lt;select id="productsMusical" name="productsMusical"&gt;
    &lt;option value="" selected="selected"&gt;--Please Select--&lt;/option&gt;
    &lt;option value="Guitars - Acoustic"&gt;Guitars - Acoustic&lt;/option&gt;
    &lt;option value="Guitars - Electric"&gt;Guitars - Electric&lt;/option&gt;
    &lt;option value="Guitars - Bass"&gt;Guitars - Bass&lt;/option&gt;
    &lt;option value="Keyboards - Acoustic Piano"&gt;Keyboards - Acoustic Piano&lt;/option&gt;
    &lt;option value="Keyboards - Digital Piano"&gt;Keyboards - Digital Piano&lt;/option&gt;
    &lt;option value="Keyboards - Synth"&gt;Keyboards - Synth&lt;/option&gt;
    &lt;option value="Drums - Acoustic"&gt;Drums - Acoustic&lt;/option&gt;
    &lt;option value="Drums - Electric"&gt;Drums - Electric&lt;/option&gt;
    &lt;option value="Drums - Band"&gt;Drums - Band&lt;/option&gt;
    &lt;option value="Microphones - Vocal"&gt;Microphones - Vocal&lt;/option&gt;
    &lt;option value="Microphones - Vocal Headset"&gt;Microphones - Vocal Headset&lt;/option&gt;
    &lt;option value="Microphones - Instrument"&gt;Microphones - Instrument&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>