1var contactForm = document.getElementById('contact-form');
2if (contactForm.checkValidity() == false) {
3 var list = contactForm.querySelectorAll(':invalid');
4 for (var item of list) {
5 item.setAttribute("style", "background-color: red;")
6 }
7}
8