JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<ul>
<li class="this-one">
this is my item
<ul>
<li>
this is a sub element
</li>
</ul>
</li>
</ul>
JavaScript
$('li').each(
function(){
var kids = this.childNodes;
for (var i=0,len=kids.length;i<len;i++){
if (kids[i].nodeName == '#text'){
$(kids[i]).wrap('<div class="tree-item-text" />');
}
}
});