My requirement is just easy: user press Ctrl key some notification appear on my page, and when released the notifications just disappear, so i need to track modifier keys such as Ctrl. Unfortunately i google and didn't find any clues, some famous keyboard libs such as Mousetrap and keymaster
seem also does not cover this topic.
Any ideas?
Modifier keys trigger keydown
(but not keypress
). Then you can simply check the flags defined on the event object. shiftKey
, altKey
, ctrlKey
, metaKey
, etc.
A full list is here: http://api.jquery.com/category/events/event-object/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With