Search code examples
javascriptkeypress

JS: Recognize dot or delete in keypress


I'd like to execute some code if the user presses the dot (on standard keybord or on numblock). But if I take it over Keycode (110), this is the same like the delete button.

How do I recognize them?

Thanks for your help!


Solution

  • Delete key (usually above arrows) is 46, numpad decimal is 110, and the keyboard period is 190.

    This is a pretty good page to know what keycodes are what: http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx

    If this doesn't answer your question, please rephrase it as it's a little confusing what you are looking for.