Answers for "copy dom element javascript"

1

Copy document DOM without reference

BodyCopy = document.body.cloneNode(true);
// ...
document.body = BodyCopy;
Posted by: Guest on August-31-2021
0

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);
Posted by: Guest on December-11-2020

Code answers related to "copy dom element javascript"

Browse Popular Code Answers by Language