Question: Create an HTML 5 form containing three input text fields and a button (type=button). The field names should be firstName, lastName, and emailAddress. Create a
Create an HTML 5 form containing three input text fields and a button (type=button). The field names should be firstName, lastName, and emailAddress. Create a JavaScript file (.js) and reference in your HTML document. Define two functions: getData() and displayData(). Apply an onclick event handler to the HTML forms button. The onclick event handler must call the getData() function. The getData() function must retrieve the form field values using the querySelector() DOM method, i.e., document.querySelector().value. Assign the collected form field values to an Object. Call the displayData() function within the getData() function and pass in the Object containing the form values as an argument. In the displayData() function, construct a string using the firstName and emailAddress values found in the Object passed in. For example: "Thank you, . Your email address is !" Make use of the querySelector(), createTextNode() and appendChild() DOM methods to render the string inside of a new "p" element in the HTML document.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
