Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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;")
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #find #div
ADD COMMENT
Topic
Name
7+2 =