JavaScript works just once
<p>I have the following script. It works when the users clicks the search button but it only works once. Please guide me how can I make it work for more clicks. Thanks,</p>

<pre><code> &lt;form action="" method="get" id="searchform"&gt;
   &lt;input name="q" type="text" id="search" size="32" maxlength="128" class="txt"&gt;
   &lt;input type="button" id="hit" value="Search"  class="btn"&gt;
 &lt;/form&gt;

&lt;script type="text/javascript"&gt;
  var nexturl ="";
  var lastid ="";
  var param;
  $(document).ready(function () {
    $("#hit").on("click", function myFunction() {
      param = $('#search').val();
      alert("I am an alert box!");
      if (param != "") {
        $("#status").show();
        var u = 'https://graph.facebook.com/search/?callback=&amp;limit=100&amp;q='+param;
        getResults(u);
      }

      $("#more").click(function () { 
        $("#status").show();
        $("#more").hide();  
        pageTracker._trackPageview('/?q=/more');
        var u = nexturl;
        getResults(u);
      });
    });
  });
&lt;/script&gt;
</code></pre>
