x
<html>
<body>
<ul id="list1"><li>Car</li><li>bus</li></ul>
<ul id="list2"><li>Ship</li><li>Plane</li></ul>
<button onclick ="removeList()">Remove List</button>
<p id="para"> This is removed node element re-inserted:</p>
<script>
function removeList(){
//Get list item to be removed
var item = document.getElementById("list1");
//Remove list items
item.parentNode.removeChild(item);
//Insert list to the “para”
var list = document.getElementById("para");
list.appendChild(item);
}
</script>
</body>
</html>
Comments
No comments have been made yet.
Please login to leave a comment. Login now