How to get user input using javascript

Last updated on February 14th, 2022 at 01:32 pm

Click to rate this tutorial!
[Total: 3 Average: 5]

Javascript display prompt to get input from user using javscript

We can use simple javascript here to prompt an input field for your visitors to enter their name for the website. Once they have done that and clicked OK their name will appear in the web page along with the rest of the content. Interesting script, Just copy paste the code below on an html file save it and run it yourself to see the output. Enjoy 🙂

<SCRIPT LANGUAGE="JavaScript">
 
var value = window.prompt("What's your name?,Question From Mistonline.in :)");
window.document.write ("Welcome , ");
window.document.write (value);    
</SCRIPT>
<div id="Main_Page">
Rest of the webpage content goes here.
</div>

Demo

Click to rate this tutorial!
[Total: 3 Average: 5]

3 replies on “How to get user input using javascript”

Leave a Reply

Your email address will not be published.