JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul id="ul_list">
<li><div>1</div>
<ul>
<li><div>1.1</div></li>
<li><div>1.2</div></li>
</ul>
</li>
</ul>
</body>
</html>
JavaScript
$('#ul_list > li').each(function() {
alert('should be 2 children, but has 0: ' + $(this).children('ul > li').length);
alert('should be 2 children, and correctly has 2: ' + $(this).children('ul').children('li').length);
$(this).children('ul > li').each(function() {
alert('made it in here');
});
});