How can I prevent adding more classes error while somebody is repeatedly clicking on the submit button?
In Chrome Dev Tools I see that they keep being added more and more if you spam the button. I don't know how to prevent this.
function errorFunc(req, message) {
const formControl = req.parentElement;
const span = formControl.querySelector('span');
span.innerText = message;
req.className += 'error';
span.className += 'error-text';
if(req !== email) {
req.value = ' ';
} else {
req.style.color = "hsl(0, 100%, 74%)";
}
}
function successFunc(req) {
req.className += 'success';
}