numeric-keypad

keyCode values for numeric keypad?

空扰寡人 提交于 2019-11-26 06:06:49
问题 Do the numbers on a numeric keypad have a different keycode than the numbers at the top of a keyboard? Here is some JavaScript that is supposed to run on the keyup event, but only if the keycode is between 48 and 57. Here is the code: $(\'#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