There are a series of if statements attached to an input element using an event listener; how do you disable a button until all of these conditional statements are passed?
button = document.querySelector("#submit")
button.disabled = true
passwordInput.addEventListener("keyup", e => {
let inputValidator = e.target.value
let numberValidator= inputValidator.match(/\d+/g)
if (inputValidator === "") {
errorEmpty.style.display = "block"
} else {
errorEmpty.style.display = "none"
}
if (inputValidator.length < 20) {
errorLength.style.display = "block"
} else {
errorLength.style.display = "none"
}
if (inputValidator === inputValidator.toLowerCase()) {
errorUppercase.style.display = "block"
} else {
errorUppercase.style.display = "none"
}
if (inputValidator === inputValidator.toUpperCase()) {
errorLowercase.style.display = "block"
} else {
errorLowercase.style.display = "none"
}
if (numberValidator == null) {
errorNumber.style.display = "block"
} else {
errorNumber.style.display = "none"
}
})