I am unable to figure where is the issue in my JavaScript code. I want show and hide the error message based on whether the field value is empty or not.
if (info == "" && hrContacts == "") {
document.getElementById("hr_contacts_error").style.display = "block";
document.getElementById("info_error").style.display = "block";
return false;
} else if (hrContacts == "") {
document.getElementById("hr_contacts_error").style.display = "block";
return false;
} else if (hrContacts != "") {
document.getElementById("hr_contacts_error").style.display = "none";
} else if (info == "") {
document.getElementById("info_error").style.display = "block";
return false;
} else if (info != "") {
document.getElementById("info_error").style.display = "none";
} else if (info != "" && hrContacts != "") {
form submit
}