javascript subtract(-) keycode
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. Don't do this in a keydown event handler - you put yourself at the mercy of different browsers' ideas about key codes and potential variation between key codes for different keyboard types