js document wont detect keydown code example
Example: javascript keypress backspace not working
Try "onkeydown" instead of "onkeypress".
KeyPress event is invoked only for character (printable) keys,
KeyDown event is raised for all including nonprintable such as Control,
Shift, Alt, BackSpace, etc.