Javascript examples for DOM:Element appendChild
Element appendChild() Method - Move a list item from one list to another:
<!DOCTYPE html> <html> <body> <ul id="myList1"><li>Coffee</li><li>Tea</li></ul> <ul id="myList2"><li>Water</li><li>Milk</li></ul> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from ww w. j ava2 s. c o m var node = document.getElementById("myList2").lastChild; document.getElementById("myList1").appendChild(node); } </script> </body> </html>