When I press 8 from the numbers present above the alphabets on the keyboard, event.which returns 56, but when I press 8 from the numpad given at the side, it returns 104 (ascii of 'h'). I was doing this :
var keyPressed = event.which;
String.fromCharCode(keyPressed); // returns 8 from keyboard, 'h' from keypad
I am doing this inside the handler for the keydown event. Now, I know that each key on the keyboard has a different keyCode, and probably, event.which is returning the keyCode for the numpad 8, which just happens to coincide with the ascii 'h'. I simply want to have 8 returned irrespective of from where it has been typed.
Also, I can't bind the above code to the keyPress event handler as it doesn't capture delete, tab etc in IE.