+ 2

Can javascript take keyboard input?

If so, how? I'm talking about keyboard input that isn't in a prompt like onclick or onmouseover.

12th Oct 2019, 1:51 PM
Y-guy
Y-guy - avatar
2 Respostas
+ 2
A 'prompt' will create a pop-up with a text box for user input. Is this what you want?
12th Oct 2019, 2:09 PM
Russ
Russ - avatar
+ 2
Yep it can. try running this simple code.. var name = prompt("Please enter your name"); variable "name" takes in the input by the user.
12th Oct 2019, 2:16 PM
Aaron Stone
Aaron Stone - avatar