Below is the snippet code which is used to define a form :
<head> <title> Check Submit Form </title> </head> <body> <form id="user_form" onsubmit="return ValidationEvent()"> <input type="text" id="username"></input> <input type="submit" id="submit_button"></input> </form> </body> </html>
To be able to extract the value of a certain HTML element, for an example an input type text, the id of the input type text must be well-known for the value inserted can be extracted as shown in the snippet code above :
The id is ‘username’ which is defined in the HTML web page file as shown below :
<input type="text" id="username"></input>
var username = document.getElementById("username").value;
And then alert the variable to display it in a pop-up window where the content of the variable will be printed on it.