+ 3

How to get input from the users in javascript programming language

I want to get the data using forms in html

31st May 2018, 6:17 AM
Irfan ali
Irfan ali - avatar
3 Réponses
+ 9
var person = prompt("Please enter your name", "Harry Potter"); if (person != null) { document.getElementById("demo").innerHTML = "Hello " + person + "! How are you today?"; } like that... https://www.w3schools.com/jsref/met_win_prompt.asp https://www.w3schools.com/js/js_input_examples.asp
31st May 2018, 6:23 AM
Scooby
Scooby - avatar
+ 3
Example: <input type="text" class="input_class"> <button class="btn" onClick="getValue()"><button> Javascript: function getValue(){ var inputVal = document.querySelector(".input_class").value alert(inputVal) }
31st May 2018, 7:25 AM
CHMD
CHMD - avatar
+ 2
<form name="f" onsubmit="alert(f[0].value); event.preventDefault();"> <input type="text" /> <button type="submit">Send</button> </form> https://code.sololearn.com/WHW6Acl3iWcY/?ref=app
31st May 2018, 11:55 AM
Calviղ
Calviղ - avatar