Hello, I would like to add a onKeyPress event listen to an entire page. I’ve tried to add it through referencing the Document (see below) but I’m getting an error that an onKeyPress cannot be added to this element. I’m writing a script that is supposed to trigger an audio clip whenever a user enters a sequence of keystrokes. Below is what I was using.
I think you’ll have to crate window.addEventListenter via Custom Element, and once it fires - dispatch the event to the page code.
(It will only work if you have your site connected to your own domain (and I don’t think it will work well in Preview Mode. Only on live site).
(It’s hard to read)
Anyway I don’t think it will work this way, since the html id of the video is not ‘myVideo’) + from other reasons.
I think the easiest way will be to have no visible UI in the custom element, just the event listener, once fires it will dispatch the event to the page code and you will continue from there with Velo.