title: Get first 4 characters of an input and insert them into another input as default text with jquery
body: <p>I need to grab the first 4 characters of two input values (if entered), and string them together and insert them into a third input as the default value of the input. I have this working except for grabbing the first four characters (right now it's grabbing the whole value, which could be a quite long airport name). </p>
  
  <p>js fiddle: <a href="http://jsfiddle.net/4byPJ/" rel="nofollow">http://jsfiddle.net/4byPJ/</a></p>
  
  <pre><code>//insert to and from values as the default seach name
  $("#from").change(function() {
      $("#nameSearch").val($("#from").val() + " to " + $("#to").val());
  });
  $("#to").change(function() {
      $("#nameSearch").val($("#from").val() + " to " + $("#to").val());
  });
  &lt;fieldset class="itineraryBlock"&gt;
          &lt;legend&gt;Itinerary&lt;/legend&gt;
  
          &lt;div class="fromFields"&gt;
            &lt;label for="from"&gt;From:&lt;/label&gt;
            &lt;input type="text" name="from" id="from" class="airportField" /&gt;
          &lt;/div&gt;
          &lt;div class="toFields"&gt;
            &lt;label for="to"&gt;To:&lt;/label&gt;
            &lt;input type="text" name="to" id="to" class="airportField" /&gt;
            &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;fieldset class="saveSearch"&gt;
          &lt;legend&gt;Do you want to save this search?&lt;/legend&gt;
          &lt;input type="radio" id="yes" value="yes" name="saveSearch" checked="checked" /&gt;
          &lt;label for="yes"&gt;Yes&lt;/label&gt;
          &lt;input type="radio" id="no" value="no" name="saveSearch" /&gt;
          &lt;label for="no"&gt;No&lt;/label&gt;
          &lt;div class="nameSearchBlock"&gt;
            &lt;label for="nameSearch"&gt;Name your search:&lt;/label&gt;
            &lt;input type="text" id="nameSearch" name="nameSearch" /&gt;
          &lt;/div&gt;
          &lt;!-- nameSearch --&gt;
        &lt;/fieldset&gt;
  </code></pre>