Why does it need to be tied to a <div>? Why don't you just make an event listener to window?
window.onkeypress = ...
This would be impractical, what if I wanted multiple divs to listen to a keypress event, but I didn't all want them to be active at once?
why you don't listen directly on the <canvas> element?
Isn't that impossible?
you can try: jsfiddle.net/bmwvrocx/
Ok, thanks for the advice.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.