Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to cut and paste an element in vanilla javascript

// Get the element
var elem = document.querySelector('#elem1');

// Create a copy of it
var clone = elem.cloneNode(true);

// Inject it into the DOM
elem.after(clone);
Source by gomakethings.com #
 
PREVIOUS NEXT
Tagged: #cut #paste #element #vanilla #javascript
ADD COMMENT
Topic
Name
9+2 =