Question
Trying to debug my assignment but keep getting this error Uncaught TypeError: Cannot set property 'onclick' of null at window.onload (email_list.js:38) var $ = function(id)
Trying to debug my assignment but keep getting this error Uncaught TypeError: Cannot set property 'onclick' of null at window.onload (email_list.js:38) var $ = function(id) { return document.getElementById(id); }; var joinList = function() { var emailAddress1 = $("email_address1").value; var emailAddress2 = $("email_address2").value; var firstName = $("first_name").value; var errorMessage = ""; // validate the entries if (emailAddress1 == "") { errorMessage = "First email address entry required"; $("email_address1").focus(); } else if (emailAddress2 == "") { errorMessage = "Second email address entry required"; $("email_address2").focus(); } else if (emailAddress2 != emailAddress1) { errorMessage = "Email address entries must match"; $("email_address2").focus(); } else if (firstName == "") { errorMessage = "First name entry required"; $("first_name").focus(); } // submit the form if all entries are valid // otherwise, display an error message if (errorMessage = "") { $("email_form").submit(); } else { alert(errorMessage); } }; window.onload = function() { $("#join_List").click(join_List); $("email_address1").focus(); };
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started