title: jQuery is one step late
body: <p>I'm counting div children. That's div with id results which is container which accepts ajax result. Problem is that when I type something into search box(which is live search), my counter shows results for previous value of the search box. For instance, when I type "bel" it shows me count for "be" and so on. Why is that, and how to make it to work like "live" counter for any change inside container div?</p>
  
  <pre><code>$('#search, #description').on("keyup", function(){
          if($('#search_results').length&gt;0){
              $('#search_results').remove();
          }
          $('#browse_wrapper').prepend("&lt;p style='border-bottom: 1px solid #C5C5C5; margin-bottom: 20px;' id='search_results'&gt;&lt;span class='glyphicon glyphicon-info-sign'&gt;&lt;/span&gt; &lt;strong&gt;"+$('div#results&gt;div').length+"&lt;/strong&gt; results for "+$('#search, #description').val()+"&lt;/p&gt;");
      });
  </code></pre>
  
  <p>Ajax code:</p>
  
  <pre><code>$(document).ready(function() {  
  
      // Icon Click Focus
      $('div.icon').click(function(){
          $('input#search').focus();
      });
  
      // Live Search
      // On Search Submit and Get Results
      function search() {
          var city = $('input#search').val();
          var description = $('input#description').val();
  
          //$('b#search-string').html(query_value);
          if(city !== '' || description !== ''){
              $.ajax({
                  type: "POST",
                  url: "ajax_php/search.php",
                  data: { city: city, desc: description},
                  cache: false,
                  success: function(html){
                      $("div#results").html(html);
                  }
              });
          }return false;    
      }
  
          $("input#search, input#description").live("keyup", function(e) {
              // Set Timeout
              clearTimeout($.data(this, 'timer'));
  
              // Set Search String
              var search_string_1 = $(this[0]).val();
              var search_string_2 = $(this[1]).val();
              // Do Search
              if (search_string_1 == '' || search_string_2 == '') {
                  $("div#results").fadeOut();
                  $('h4#results-text').fadeOut();
              }else{
                  $("div#results").fadeIn();
                  $('h4#results-text').fadeIn();
                  $(this).data('timer', setTimeout(search, 100));
              };
          });
  
  });
  </code></pre>