Best way to find out if element is a descendant of another there is another question, very similiar to this one but its jquery.
so, how do I do it in js ? I have di
You can use node.contains to check if a node contains another node. https://developer.mozilla.org/en-US/docs/Web/API/Node.contains
node.contains