- 1
How to add a keyboard listener to my WebPage using JS
I want to make a game that move a block on pressing keys Now I am using input tag of button type but I need keyboard listeners which are better option for this thing so help me please
3 Answers
0
window.addEventListener('keyup', myFunction)
So you can track the type of a key being pressed
0
'keyup', 'keydown'
- 1
Can u guys explain me wth an complete example plzzzzzz