JSFiddle - React, Tailwind, and code Playground
HTML
<article>
<div id="div-01">Here is div-01
<p id="div-02">Here is div-02
<spam id="div-03">Here is div-03</span>
</p>
</div>
</article>
JavaScript
var el = document.getElementById('div-03');
var r1 = el.closest("p");
console.log(r1);