Move a <li> element from one list to another:
Click the button to move an item from one list to another.
<!DOCTYPE html> <html> <body> <ul id="myList1"><li>CSS</li><li>HTML</li></ul> <ul id="myList2"><li>SQL</li><li>Java</li></ul> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from ww w .java 2s .c o m var node = document.getElementById("myList2").lastChild; var list = document.getElementById("myList1"); list.insertBefore(node, list.childNodes[0]); } </script> </body> </html>