Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>The Element Object</h1> <h2>The appendChild() Method</h2> <ul id="myList1"> <li>Coffee</li> <li>Tea</li> </ul> <ul id="myList2"> <li>Water</li> <li>Milk</li> </ul> <p>Click "Move" to move an item from one list to another:</p> <button onclick="myFunction()">Move</button> <script> function myFunction() { const node = document.getElementById("myList2").lastElementChild; document.getElementById("myList1").appendChild(node); } </script> </body> </html>