First Parent of an HTML element
To find the closest parent of a specific HTML type (div, ul, etc...) use the closest method. It takes query selectors as parameters.
var closestElement = targetElement.closest(selectors);
To find the closest parent of a specific HTML type (div, ul, etc...) use the closest method. It takes query selectors as parameters.
var closestElement = targetElement.closest(selectors);