jQuery ближайший
$( "li.item-a" )
.closest( "ul" )
.css( "background-color", "red" );
Alberto Peripolli
$( "li.item-a" )
.closest( "ul" )
.css( "background-color", "red" );
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);