+ 8
I want to use any keystroke on the keyboard only as a trigger.
JS code. After pressing any key on the keyboard i want to do something, for example: document.write("Hello!"). I don't want to print this key, he serves only as a trigger of action. I've tried with: html: <input id="mess"> JS: let box = document.getElementById('mess'); box.addEventListener('keydown', (event) => {document.write("Hello!")}); but at the begining it opens text box on the page & prints out pressed key in this box. Any idea, please.
1 Odpowiedź
0
It works!
Could you please share me the code please