const setEventListeners = (formElement) => {
const inputList = Array.from(formElement.querySelectorAll(".form__input"));
inputList.forEach((inputElement) => {
inputElement.addEventListener("input", function () {
checkInputValidity(formElement, inputElement);
});
});
};
const enableValidation = () => {
const formList = Array.from(document.querySelectorAll(".form"));
formList.forEach((formElement) => {
formElement.addEventListener("submit", (evt) => {
evt.preventDefault();
});
setEventListeners(formElement);
});
};
// Call the function
enableValidation();