Do the numbers on a numeric keypad have a different keycode than the numbers at the top of a keyboard?
以下是一些应该在keyup事件上运行的JavaScript,但仅当键码在48到57之间时才会运行.以下是代码:
$('#rollNum').keyup(function(e) {
if(e.keyCode >= 48 && e.keyCode <= 57) { //0-9 only
var max = 15;
var textLen = $(this).val().length;
var textLeft = max - textLen;
. . .
My problem is that this code only runs in response to the numbers entered at the top of the keyboard, but does not run in response to numbers entered from the numeric keypad.
I'm thinking the answer must be that the numeric keypad has different keyCode values, but how do I find out what those are?