JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<head>
</head>
<body>
  <ul id="nav_accordion">
    <li><div>1</div>
        <ul>
            <li><div>1.1</div></li>
            <li><div>1.2</div></li>
        </ul>
    </li>
</ul>
</body>
</html>

JavaScript

$('#nav_accordion > li').each(function() {
    styleNavLevel($(this),0);
});
function styleNavLevel($li_item,depth) {
    var new_depth = depth+1;
    var depth_px = (new_depth*10)+'px'
    alert('children: ' + $li_item.children('ul > li').length);
    alert('children: ' + $li_item.children('ul').children('li').length);
    $li_item.children('ul > li').each(function() {
        alert('made it in here');
    });
}