Get JavaScript to detect an input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Get JavaScript to detect an input

Hi, I'm trying to create a text-based game that uses a prominent input bar on the bottom of the page. However, since I'm new to code, I don't know how I can get JavaScript to detect what the player types into the input. How can I get it to do this?

1st Jul 2017, 2:59 PM
Dreadnought
Dreadnought - avatar
3 Answers
+ 5
<input type="text" id="lol"> do this <script> x = document.getElementById("lol").value // this is the thing u want </script>
1st Jul 2017, 3:02 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
Thanks!
1st Jul 2017, 3:03 PM
Dreadnought
Dreadnought - avatar
0
thanks for liking my code
2nd Jul 2017, 1:50 AM
Elijose1005 Fishing