Is it possible to use these keyboard event listeners without using an input field, and to call specific functions based on the k | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it possible to use these keyboard event listeners without using an input field, and to call specific functions based on the k

I am trying to make a Tetris game without buttons, just keyboard controls, however, I am having difficulties doing this without an input field like demonstrated here: https://www.w3schools.com/jsref/event_onkeypress.asp Here is my code: https://code.sololearn.com/WcT7LGC7moHS/#html Ignore the comments and code under the body tag.

10th Mar 2019, 5:06 PM
Fleet
Fleet - avatar
2 Answers
+ 2
Very nice game btw. But that won't work on mobiles and tablets since they need an input field to pop up the soft-keyboard
13th Mar 2019, 11:44 AM
Pete Wright
Pete Wright - avatar
0
I appreciate the compliment, however, this is not my code. I am simply trying to make the gameplay faster and more authentic to modern Tetris by using keyboard controls. I can't take credit for someone else's code. That's not right.
13th Mar 2019, 4:12 PM
Fleet
Fleet - avatar