ok, i need my code to check if minus/subtract/- was pressed, if it was pressed i want an alert box to pop. i tried with both 109
and 189
key codes but i still don't get the desired result. although i press "-"
i don't get that alert box
ok, i need my code to check if minus/subtract/- was pressed, if it was pressed i want an alert box to pop. i tried with both 109
and 189
key codes but i still don't get the desired result. although i press "-"
i don't get that alert box
The JavaScript charCodes, which you test for during a keypress event, are ASCII. 109 is the correct keyCode, if used in a keydown or keyup event.
"-" has a charCode of 45.