I’m trying to add shortcut keys to a web page. (I use PHP on localhost to serve this page so I control it.)
Take a look at the Mousetrap library. It makes that sort of thing pretty straight forward from what I recall.
Thanks. In the end I created an event listener for the “keypress” event - using
addEventListener() and decoded the
event object passed to the handler.
It was easier than I thought. The
event object had a property that told me whether Ctrl had been pressed, together with eg ‘a’.