javascript clone div code example
Example 1: js clone element
// Syntax:
let newClone = node.cloneNode([deep])
// Example:
let p = document.getElementById("para1")
let p_prime = p.cloneNode(true)
Example 2: js copy a div
// Get the element
var elem = document.querySelector('#elem1');
// Create a copy of it
// The 'true' is to allow nested elements to be copied as well
var clone = elem.cloneNode(true);