//
https://api.jquery.com/wrapall/
https://api.jquery.com/wrapinner/
Wrap an HTML structure around each element in the set of matched elements.
在一组匹配的元素中的每个元素周围包装一个HTML结构。
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
</div>
$( ".inner" ).wrap( "<div class='new'></div>" );
<div class="container">
<div class="new">
<div class="inner">Hello</div>
</div>
<div class="new">
<div class="inner">Goodbye</div>
</div>
</div>
$( ".inner" ).wrap(function() {
return "<div class='" + $( this ).text() + "'></div>";
});
<div class="container">
<div class="Hello">
<div class="inner">Hello</div>
</div>
<div class="Goodbye">
<div class="inner">Goodbye</div>
</div>
</div>
Dynamic nested ul\li list from json data using Javascript
https://stackoverflow.com/questions/21140069/dynamic-nested-ul-li-list-from-json-data-using-javascript