title: Removing on keyup from jQuery search script
body: <p>I have a jQuery search script which uses the on keyup function to submit the query. How can I make it search when the user presses enter?</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>$(document).ready(function(){
      $("#search").keyup(function(){
          var search=$(this).val();
          var query=encodeURIComponent(search);
          var yt_url='search.php?q='+query+'&amp;page=1';
          window.location.hash='search/'+query+'/1/';
          document.title=$(this).val()+" - My Search Script";
          $.ajax({
              type:"GET",
              url:yt_url,
              dataType:"html",
              success:function(response){
                  $("#result").html(response);
              }
          });
      });
      if(window.location.hash.indexOf('#search/')==0){
          query=window.location.hash.replace('#search/', '').replace('/1/', '');
          $('#search').val(decodeURIComponent(query)).keyup();
      }
  });
  </code></pre>