title: Populate table based in select
body: <p>I am using this code to populate a table based in the select option chosen. This code works fine if the user click in the select, but not if the user uses the arrow keys. </p>
  
  <p>In that case the table is not cleaned, and the data from json is populated sequentially. So, the output in table will not match the current selected option.</p>
  
  <p>Any idea about this?</p>
  
  <pre><code>$('select').on('change', function() {
      $('.agencies_table').html('');
      $.getJSON("/users/agencies/" + this.value, function(data) {
          $.each(data.json_list, function(i, obj) {
              $('.agencies_table').append('&lt;tr&gt; &lt;td&gt;' + obj.label + '&lt;/td&gt; &lt;/tr&gt;');
          });
      });
  });
  </code></pre>