You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can implement some form validation by applying existing method: validity.valueMissing
you can either have a separate file with all the form validation or have it in your index.js file
const username = document.getElementById("new-username");
const userErr = document.getElementById("userErr");
let checkUser = () => {
if (username.validity.valueMissing) {
displayErr(userErr, "Please enter a username");
} else {
displayErr(userErr, "");
return true;
}
};
function displayErr(errElem, errMsg) {
errElem.innerText = errMsg;
}
username.addEventListener("focusout", checkUser);
The text was updated successfully, but these errors were encountered:
You can implement some form validation by applying existing method: validity.valueMissing
you can either have a separate file with all the form validation or have it in your index.js file
The text was updated successfully, but these errors were encountered: