+ 2

How can you read keyboard input in JS?

I've seen codes that do this, but I don't know how to do it.

19th May 2019, 6:13 PM
Pokémaniac7
Pokémaniac7 - avatar
2 Réponses
+ 6
You can do it like this: HTML: <p onkeypressed = "key(event)"></p> JS: function key(event) { x = event.which; alert(x); } It will alert the number value of the key that was pressed down
19th May 2019, 6:28 PM
Airree
Airree - avatar
0
Used attribute Onkeyup="function-name()" And after that Get the value its
20th May 2019, 7:19 AM
Rahman Rezaie 🇦🇫
Rahman Rezaie 🇦🇫 - avatar