Answers for "javascript check if element has child with class"

39

javascript check if element has class

if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
Posted by: Guest on August-02-2019
0

check if element has specific child javascript

var hasChild = parentDiv.querySelector("#child2") != null;
//The querySelector() method lets you search the subtree beneath the 
//starting element using the given CSS selector string. If the element is found,
// its DOM node is returned.
Posted by: Guest on July-16-2021

Code answers related to "javascript check if element has child with class"

Code answers related to "Javascript"

Browse Popular Code Answers by Language