Answers for "js unwrap element"

0

js unwrap element

// select element to unwrapvar el = document.querySelector('div');
// get the element's parent nodevar parent = el.parentNode;
// move all children out of the elementwhile (el.firstChild) parent.insertBefore(el.firstChild, el);
// remove the empty elementparent.removeChild(el);
Posted by: Guest on February-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language