JSFiddle - React, Tailwind, and code Playground

by Aakash Khapare M

HTML

<ul class="top">
    <li>A</li>
    <li>B</li>
    <li>
        <ul>
            <li>1</li>
            <li>2</li>
        </ul>
    </li>
</ul>
<div></div>

JavaScript

$("div").append($(".top").children().map(function(k, v){
    if($(this).children().length == 0)
        return this;
}).clone());