In our example we have shown one button and called a function show_alert by connecting it to onClick event of the button.
Here is the code to display an alert message window.
Here msg is the variable and we are displaying the text stored inside the variable msg in the alert box.
Here is the code of the alert window.
Here we have displayed a variable data in our alert window. Same way we can display input data of the user from a text box or from any other input field in a alert window. This is used by developers to check the status of the variables at different stage of script execution.
Try to develop a script which will take the user input from a text box and display them in an alert window.Solution ? Check this