Question: Learning more about DOM - nodeValue Versus innerHTML The following is a HTML/JavaScript question. Create an application interface as shown below that will check for
Learning more about DOM - nodeValue Versus innerHTML
The following is a HTML/JavaScript question.
Create an application interface as shown below that will check for email address confirmation for signups.
1. Use the respective html and CSS files given in this assignment and build upon the structure by writing an external Javascript code to make the above interface work.
2. For each user entry of the email address, compare to check if the addresses match.
3. If the addresses match, get the value of firstChild node of the respective id element.
PLEASE use the attached INCOMPLETE JavaScript code that I have provided you to complete this assignment. The HTML and CSS codes that are attached are ONLY FOR REFERENCE. Your primary focus is on completing the JavaScript portion of the assignment. Please provide a detailed and complete answer for this question. PLEASE use JavaScript coding and programming ONLY! Do NOT answer in plain old Java/Python/programming language code, or give a few paragraphs on how to use JavaScript , or even UNIX bash or perl script. I need 100% complete/genuine help and a definitive solution to my problem.
HTML Script:
Please join our email list
JavaScript Script:
var $ = function(id) { return document.getElementById(id); };
var joinList = function() { var emailAddress1 = $("email_address1").value; var emailAddress2 = $("email_address2").value; var isValid = true; if (emailAddress1 == "") { $("emailAddress1_error") .firstChild.nodeValue = "This field is required."; isValid = false; } else { $("email_address1_error") .firstChild.nodeValue = ""; } if (emailAddress2 == "") { $("emailAddress2_error") .firstChild.nodeValue = "This field is required."; isValid = false; } else { $("email_address2_error") .firstChild.nodeValue = ""; } if (("first_name") .value == "") { $("first_name_error") .firstChild.nodeValue = "This field is required."; isValid = false; } else { $("first_name_error") .firstChild.nodeValue = ""; } if (isValid) { $("email_form") .submit(); };
window.onload = function() { $("join_list") .onclick = joinList; $("email_Address1") .focus(); };
CSS Script:
body { font-family: Arial, Helvetica, sans-serif; background-color: white; margin: 0 auto; width: 670px; border: 3px solid blue; padding: 0 2em 1em; } h1 { color: blue; margin-bottom: .5em; } label { float: left; width: 11em; text-align: right; } input { margin-left: 1em; margin-bottom: .5em; } span { color: red; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
