title: binding to click event - event only fires once
body: <p>I'm using jquery to paginate an HTML table.</p>
  
  <p>I have 2 CSS classes, <em>aPage</em> and <em>thePage</em>,
  a javascript function that creates a pagination string,
  and jquery code to bind each "page" to the <em>click</em> event so that the pagination string is calculated when the page is clicked.</p>
  
  <p>My problem is that the click event only fires once, though I want it to fire each time a page is clicked.</p>
  
  <p><em><strong>Any help is greatly appreciated.
  Thanks!!</em></strong></p>
  
  <p>My javascript/jquery code is:</p>
  
  <pre><code>var thisPage=1; npages=10;
   //initial pagination
    $("#pag").html(showPag(thisPage,npages));
  
   //  bind pagination string to click event
       $(".aPage").click(function(event){
             var thisPage=$(this).text()
       $("#pag").html(showPag(thisPage,npages));
       });
   // function that returns pagination string
       function showPag(thisPage,npages) {
       p="";
       for(i=1;i&lt;=10;i++){
       if(i==thisPage) {
       p+="&lt;span class='thePage'&gt;"+i+"&lt;/span&gt;"
        }
       else {p+="&lt;span class='aPage'&gt;"+i+"&lt;/span&gt;" }
       }
       return p;
     }
  </code></pre>