Determines if the child is a child of the parent in the DOM.
child
parent
Note that it returns false if the parent and child match. If you want to check if an element is a descendent or the same as a parent, use isElementSameOrChildOf.
false
isElementSameOrChildOf
Element, EventTarget, or CSS selector for child.
Element, EventTarget, or CSS selector for parent.
true if the child is a child of the specified parent.
true
This function doesn't throw if the child and/or parent elements don't exist. Rather, it just returns false. This was a deliberate choice.
Determines if the
childis a child of theparentin the DOM.Note that it returns
falseif theparentandchildmatch. If you want to check if an element is a descendent or the same as a parent, useisElementSameOrChildOf.