Javascript DOM HTML UL move list item

Description

Javascript DOM HTML UL move list item

View in separate window

<!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  .j  a v  a  2 s  . co m
  var node = document.getElementById("myList2").lastChild;
  document.getElementById("myList1").appendChild(node);
}
</script>

</body>
</html>



PreviousNext

Related