+ 1

how to take an input in Java script

18th Oct 2016, 5:22 PM
Rohit Mishra
Rohit Mishra - avatar
2 Answers
+ 2
var text = prompt("Please enter your text.", "default value");
20th Oct 2016, 6:35 PM
[No Name]
+ 2
If you are trying to get a normal input/form from html first: <input id="name"> Then use the js: <script> var a=document.getElementById("name"); </script> or if you want to make it an if statement var a=document.getElementById("name").value; if (a==="your name"){ //your code here }
28th Oct 2016, 11:03 AM
umop ap!sdn
umop ap!sdn - avatar