title: Disable and Enable Arrowkeys by javascript
body: <p>I have a scenario where first I need to disable keyboard arrow keys and after some processing again Enable it,for this I write this jquery function</p>
  
  <pre><code>function DisableArrowKeys() {
          var ar = new Array(37, 38, 39, 40);
          $(document).keydown(function(e) {
              var key = e.which;
              if ($.inArray(key, ar) &gt; -1) {
                  e.preventDefault();
                  return false; 
             }
              return true;
          });
      }
  </code></pre>
  
  <p>this function can disable arrow keys,after some processing I need to enable arrow key for this I made changes in the function like below</p>
  
  <pre><code>function EnableArrowKeys() {
          var ar = new Array(37, 38, 39, 40);
          $(document).keydown(function(e) {
              var key = e.which;
              if ($.inArray(key, ar) &gt; -1) {              
                  return true;
              }           
          });
      }
  </code></pre>
  
  <p>But when we call that function it does not enable arrowkeys.</p>