title: jquery detecting numpad keypress value
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5630918/get-correct-keycode-for-keypadnumpad-keys">Get Correct keyCode for keypad(numpad) keys</a>  </p>
  </blockquote>
  
  
  
  <p>I'm writing an application that needs to be able to get the value of numbers pressed on the keyboard. I've come up with the following code:</p>
  
  <pre><code>    var keyVal = "";
      $(document).on("keydown.xRuleKey", function(e) {
          var keyChar = String.fromCharCode(e.which);
          if (!isNaN(keyChar)) {
              keyVal += keyChar;
          }
      })
  </code></pre>
  
  <p>This works fine for the numbers on the top of the keyboard but when I use the numpad, the characters "`abcdefghi" are returned instead of "0123456789". Is this normal or is my keyboard weird? If it's normal is it safe to simply to set up a key/value pair to translate the letter to it's number equivelant or will that conflict with anything else. I don't think it will conflict with the regular letter keys as they return uppercase characters and the numpad returns lowercase.</p>
  
  <p>Any thoughts? Anyone dealt with this before?</p>