title: preventing the page from responding to pageup/pagedown events for page scrolling
body: <p>I am using jquery in one of my projects. I have a scenario where I have to add keyboard events to the td cells of a table to move up and down in them. I was able to achieve this using the following code.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
   var tds = jQuery("#myTable td");
   tds.bind('keyup', function(event){        
        var key = event.which;
        moveSelection(key, jQuery(this), tds);
        event.preventDefault();                        
   });
   function moveSelection(key, current_td, all_tds){    
      var index = parseInt(current_td.attr("id"));        
      if (key == 13) {           //Enter Key
          current_td.click();
        } else if(key == 38) {   //Page Up Key         
          if(all_tds[index - 1]){
              all_tds[index - 1].focus();
          }
        } else if(key == 40) {   //Page Down Key
            if(index &lt; all_tds.length){
              var next_index = index + 1;
              if(next_index &lt; all_tds.length){
                  all_tds[index + 1].focus();
              }                
           }
      }            
  }    
  </code></pre>
  
  <p></p>
  
  <p>I was able to move through the td cells if the page has no scroll bars. But when the page has scroll bars, when I use PageUp/PageDown keys two things happen.</p>
  
  <ol>
  <li>My page scrolls up/down based on the key pressed.()</li>
  <li>The respective td selection moves/up based on the key pressed.</li>
  </ol>
  
  <p>In the first case, it might be because of the events are bound to the page as well as my table tds. How can I prevent this. I dont want my page to scroll when I am dealing with my table. I tried a lot but failed. Looking here for some help.</p>
  
  <p>Any help greatly appreciated.. Thanks in advance...</p>