0

I get the "incorrect" value for event.which in chrome. for example:

$(document).keypress(function (e) {
    alert(String.fromCharCode(e.which));
    alert(e.which);
});

this code produces two alerts when I press the numpad '+' key, first says k, second says 107. I want the first one to say + and the second, well the second doesn't matter too much, all I care about is getting the + symbol when typing the + key. Same for all mathematical operators, I am writing a calculator and need those symbols correct for the input elements. How do I do it?

---- WORKING ---- I must have done something wrong before, now it works great...

4

1 回答 1

0

尝试改用 .keydown ,我之前在 chrome 中的按键行为方面遇到了一些问题,当我使用 keydown 时得到了解决

于 2012-09-19T16:50:23.570 回答