JSFiddle - React, Tailwind, and code Playground

by HenryGarle

HTML

<div id="One">
    <div id="Two">
        <div id="Three">
            <div id="Four">
    
            </div>
        </div>
    </div>
</div>

JavaScript

var top = $("#Four").parents("#One");

alert($(top).html());

//Example using index

//First parent - 2 levels ip from #Four
// I.e Selects div#One
var topTwo = $("#Four").parents().eq(2);

alert($(topTwo ).html());