I need to capture that pressed key is 0-9 including numbers from numpad. I wrote a function that checks it but it doesn't work on numpad digits
function getKeyVal(e) {
var order = String.fromCharCode(e.keyCode);
return /^\s*\d+\s*$/.test(order)
}
String.fromCharcode return "a" from numpad key 1.
Can anybody help?