JSFiddle - React, Tailwind, and code Playground

by Taleeb Anwar

HTML

<div class="start">
    <div class='a'> <!-- this -->
        <div class='b'></div>
    </div>
    <div class='c'></div> <!-- this -->
    <div class='d'> <!-- this -->
        <div class='e'>
            <div class='f'></div>
        </div>
    </div>
</div>

JavaScript

$('div[class="start"]').each(function () {
    doSomething($(this));
    //this below is what I want to achieve
    $(this).find('> div').each(function () {
        doSomethingElse($(this));
    });
});

function doSomething($ctrl) {
    console.log($ctrl);
}

function doSomethingElse($ctrl) {
    console.log($ctrl);
}