+ 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.
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
0
Used attribute
Onkeyup="function-name()"
And after that
Get the value its