Source Code:
(back to article)
Submit
Result:
Report an issue
<body> <div id="mydiv">one div here, or two divs if cloned! <span>And here is a span inside the div!</span></div> </body> <script> const div = document.getElementById("mydiv"); const clone = div.cloneNode(true); document.body.appendChild(clone); </script>