I suppose this should be pretty simple, but I'm still learning to work with javascript. I have this function that I am using to pull up a form on the click of a button
function addEmployee() {
document.getElementById("add_employee")
.innerHTML="\
<input name=\"new_emp_name\" value=\"Employee Name\" required/>\
<input name=\"new_emp_idp\" value=\"Employee Number\" required/>\
<select name=\"new_emp_status\" required>\
<option value=\"0\">Manager</option>\
<option value=\"1\" selected>Server</option>\
<option value=\"2\">Bartender</option>\
<option value=\"3\">Host</option>\
</select>\
<input type=\"submit\" value=\"Add employee\">\
";
}
which works fine. I want to add code for each input that will clear each field when it's clicked, such as...
onfocus="if(this.value == 'Employee Name') { this.value = ''; }"
so that each input would look something like
<input name=\"new_emp_name\" onfocus="if(this.value == 'Employee Name') { this.value = ''; }" value=\"Employee Name\" required/>\
but there's obviously something terribly wrong with my understanding of the syntax. Please advise! And thank you for your patience if I haven't searched for this question thoroughly.