+ 3

How to take User inputs in Javascript instead of using prompt, alert, etc ??

Javascript user inputs

10th Feb 2018, 2:49 AM
Anurag Pilankar
3 Antworten
+ 8
Here is a simple example: https://code.sololearn.com/WTXqRA74vGUz
10th Feb 2018, 3:32 AM
John Wells
John Wells - avatar
+ 5
As what Jayden said, you could use the input tag in HTML to get the user to input something. From there, you could also have a submit button that runs a function which checks what the value of the input field is, giving the result of what the user had input.
10th Feb 2018, 3:08 AM
Faisal
Faisal - avatar
+ 4
There are various ways, in Javascript, to get user input. Here's a simple example: In your HTML: <input id="someText"> Javascript code to get the input field's value: document.getElementById("sometext").value; Hope it helps.
10th Feb 2018, 3:14 AM
dunfc
dunfc - avatar