var my_string = prompt("Please enter your name");
We can show some default text while displaying the prompt. Here is an example where a default message is displayed for the visitor to enter first name.
var my_string = prompt("Please enter your name","enter your first name only");
The above code will display the prompt window with some default text.
We can check the entered data by using if else condition.
Here is the demo of this code. Click the button below to display the prompt message.
Found anything wrong or wants to improve the code by adding more features? Post your short comment here or use the Forum