title: jquery Filter dropdown and set selected not working
body: <p>I'm still new to JQuery, Javascript but this is what I have:</p>
  
  <p>Here is my script:</p>
  
  <pre><code>/* Check for zip code input */
  $('#editZipCode').keyup(function() {
  
      var inputString = $('#editZipCode').val();
  
      if(inputString.length == 5) {   
  
      $.ajax({
          url: base_url+"/zip_code_search/"+inputString,
  
          success: function(data) {
  
              if(data.length &gt; 0) {
  
                  var parts = data.split(':');
  
                  $('select[name="city"] option').filter(function() { return $(this).text() == parts[0]; }).prop('selected', true);
                  $('select[name="state"] option').filter(function() { return $(this).text() == parts[1]; }).prop('selected', true);
  
              }else{
  
                  $('select[name="city"] option[value="0"]').prop('selected', true);
                  $('select[name="state"] option[value="0"]').prop('selected', true);
  
              }
          }
  
      });
  
  
      }else{
                  $('select[name="city"] option[value="0"]').prop('selected', true);
                  $('select[name="state"] option[value="0"]').prop('selected', true);
      }
  
  });
  </code></pre>
  
  <p>Here is my html:</p>
  
  <pre><code>&lt;form action="" method=""&gt;
  
   &lt;input type="text" id="editZipCode" name="zip_code"&gt;
  
   &lt;select id="StateOption" name="state"&gt;
     &lt;option value="0"&gt;-Select-&lt;/option&gt;
     &lt;option value="AK"&gt;AK&lt;/option&gt;
     &lt;option value="AL"&gt;AL&lt;/option&gt;
     &lt;option value="AR"&gt;AR&lt;/option&gt;
     &lt;option value="AZ"&gt;AZ&lt;/option&gt;
   &lt;/select&gt;
  
   &lt;select id="CityOption" name="city"&gt;
     &lt;option value="0"&gt;-Select-&lt;/option&gt;
     &lt;option value="ADAK"&gt;ADAK&lt;/option&gt;
     &lt;option value="AKIACHAK"&gt;AKIACHAK&lt;/option&gt;
     &lt;option value="AKIAK"&gt;AKIAK&lt;/option&gt;
   &lt;/select&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>The problem im facing is that it will not set the selected option of the CityOptions dropdown, the StateOptions dropdown works fine.</p>
  
  <p>When I enter the zip code it sets the StateOption dropdown box to the one that matches the one returned from the ajax call but not the CityOption.</p>
  
  <p>If I log parts[0] or parts[1] to the console they both print out the city/state that matches the zip code entered in the input field but again it will only set the state option to the matched value not the city option.</p>
  
  <p>Am I just missing something obvious here?</p>
  
  <p>Thanks in advance!</p>
  
  <p>p.s. I'm using <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" rel="nofollow">http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js</a> if thats important?</p>