Ask For User Input Using Alert Box
I want the user to input a piece of text in an alert box. HTML:
Solution 1:
Solution 2:
You can also specify a default value for the prompt using
var value = prompt('Enter Value', 'Default Value');
Also note: "Cancel" from the prompt will return null.
Try a demo here: http://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt
Post a Comment for "Ask For User Input Using Alert Box"