var el = document.getElementById('div-03'); var r1 = el.closest("#div-02"); // returns the closest parent element with the id=div-02
var closestElement = targetElement.closest(selectors);