Question

i want to know how to get the ascii code for the combination of keys. Like i want to handle event for some unique key combination [alt+ctrl+shift]. Alternatively can you please tell me the ascii code for [alt+Enter], [ctrl+Enter].

Was it helpful?

Solution

There are flags on the event object that tell you if the alt, control or shift keys have been entered:

if (event.shiftKey) {}
if (event.altKey) {}
if (event.ctrlKey) {}

To get the key code (e.g. space), you need to check the event.keycode (13 will get you enter)

if (event.keyCode === 13){}

OTHER TIPS

There aren't really standard mappings from keyboard codes to ASCII. Maybe this PC keyboard scan code table will help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top