JSFiddle - React, Tailwind, and code Playground

by kalmarsh80

HTML

<div id="top">
    <div>1</div>
    <div>
        <h2>
            <div>XXXXXXXXX</div>
        </h2>
    </div>
    <div>3</div>
</div>
<div id="result"></div>

CSS

#result{color:red;}

JavaScript

$("#top>div").each(function(index){
    $("#result").append("<p>index:" + index + " > " + $(this).text() + "</p>");
});