Answers for "js find :invalid inside div"

0

js find :invalid inside div

var contactForm = document.getElementById('contact-form');
if (contactForm.checkValidity() == false) {
    var list = contactForm.querySelectorAll(':invalid');
    for (var item of list) {
        item.setAttribute("style", "background-color: red;")
    }
}
Posted by: Guest on October-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language