Sorry if this is a simple question! I am new to javascript.
I am trying to check if a div has a specific child (I will call it "child2"). I know about .hasChildNodes (), but as far as I know, this only lets you know if there are child nodes. I tried .contains like this:
if (parentDiv.contains(child2) == false) {
but even if parentDiv contains child2, it still returns false. It seems like such a simple thing, and I'm trying to search around, but I had no luck in pure js. Thanks!
source share