I have an example of these lists:
<h2> Lista 1 </h2>
<ul class="lista1" id="lista1">
<li>Item1</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
<h2> Lista 2 </h2>
<ul class="lista2" id="lista2">
<li>Item5</li>
<li>Item6</li>
<li>Item7</li>
</ul>
What I want is just to invert the lists by click
clicking on a button: The items from list 1 are moved to list 2 and the items from list 2 are moved to list 1.
Just get the innerHTML of both elements and assigning it to the other you get it.
And with jquery using the method
html()
that does the same asinnerHTML
: