findParent
findParent<
T>(element,tag,classN):false|T
Defined in: core/dom/query.ts:50
Returns the closest ancestor with a given tag name and class name.
Starts at the parent, so the element itself is never returned. It takes one tag name and one class name, and both must match.
Type Parameters
Section titled “Type Parameters”T extends Element = HTMLElement
Parameters
Section titled “Parameters”element
Section titled “element”Element
Element to start from.
string
Tag name, in upper case in HTML documents: 'DIV', not 'div'.
classN
Section titled “classN”string
A single class name.
Returns
Section titled “Returns”false | T
The ancestor, or false if there is none.
Example
Section titled “Example”const carousel = findParent(slide, 'DIV', 'js-carousel-initialized');if (carousel) { // ...}