<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<ul id="list1">
<li>Orange</li>
<li>Apple</li>
<li>Grapes</li>
<li>Banana</li>
</ul>
<ul id="list2">
<li>Carrot</li>
<li>Reddish</li>
</ul>
<script>
var target = document.getElementById("list1").children[0];
var copy = target.cloneNode(true);
console.log(copy);
document.getElementById("list2"). appendChild(copy);
</script>
</body>
</html>
OUTPUT
Comments
Post a Comment