Answer the question
In order to leave comments, you need to log in
Why do validation errors appear?
I connected a small Pristine
library for validation .
After correctly filling in all the fields and submitting the form, a window appears for 3 seconds, the form is cleared of filled inputs with
and errors with the help of a function from the library.
All this works, but I also need to close the pop-up window with a button. I added a handler that, when the button is clicked, removes the active window class so that it disappears. But after clicking on all the fields, errors appear. Why do they appear and how to remove them? Many thanks in advance to whoever is willing to look into this.
codepen link: https://codepen.io/Lirrr/pen/ZEWVqOx
To catch the problem, you need to fill in all the fields, click on submit and close the pop-up window with the button. elem.value = "";
pristine.reset();
Answer the question
In order to leave comments, you need to log in
document.querySelector('.form-thx__close').addEventListener('click', (e) => {
e.preventDefault();
document.querySelector('.form-thx').classList.remove('is-open ');
});
canceled the standard behavior of the browser and it seemed to help
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question