The closest JS Element returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.
Syntax
element.closest(selectors)
Parameters
selectors
Patterns that match elements in a tree structure.
The closest JS Element returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.
element.closest(selectors)
Patterns that match elements in a tree structure.