// checks that anything has been entered into password fields
if (password.validity.valueMissing || confirmPassword.validity.valueMissing) {
error.innerHTML = "Please enter a password and confirm your password";
error.className = "error";
password.classList.add("incorrect-field");
confirmPassword.classList.add("incorrect-field");
return;
}
// checks that email is valid
if (regEmail.validity.typeMismatch || regEmail.validity.valueMissing) {
console.log("reached");
error.innerHTML = "Please enter a valid email address";
error.className = "error";
regEmail.classList.add("incorrect-field");
return;
}
// checks that anything has been entered into password fields
if (password.validity.valueMissing || confirmPassword.validity.valueMissing) {
error.innerHTML = "Please enter a password and confirm your password";
error.className = "error";
password.classList.add("incorrect-field");
confirmPassword.classList.add("incorrect-field");
return;
}
looks like you repeat the same if statement twice @ checks that anything has been entered into password fields
looks like you repeat the same if statement twice @ checks that anything has been entered into password fields