Hi soles!
Try this:
In your function "ValidateEmail(input, el)",
instead of:
if (input.value.match(validRegex)) { return true;}
use:
if (input.value.match(validRegex)) { input.value =""; el.textContent=""}
<------ This clears the input field and the error message.
and in your other function do the same with an else statement at the end:
function isEmpty(inputElement, element, message, label) {
if(!inputElement.value) {
inputElement.style.borderColor = 'hsl(0, 100%, 74%)';
element.textContent = ${message} cannot be empty
styling(label)
} else { inputElement.value = ""; element.textContent = ""; }
}
Following the same logic you can reinstate the default styles and remove the red border.
I hope this helps! Great job with the functions by the way!