With the Move_ULLI
function, how is it possible to move the entire List (UL+LI) into the DIV with the destination
class?
I'm not intending to use IDs to identify DIVs or UL List, just by ClassName() and TagName().
HTML:
<div class="container">
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
<div class="destination"></div>
<input type="button" onclick="Move_ULLI" value="MOVE ULLI" />
</div>
JavaScript:
<script>
function Move_ULLI() {
var fragment = document.createDocumentFragment();
fragment.appendChild(document.querySelectorAll("ul"));
document.getElementsByClassName('destination').appendChild(fragment);
}
</script>
Intended Result:
<div class="container">
<div class="destination">
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
</div>
<input type="button" onclick="Move_ULLI" value="MOVE ULLI" />
</div>