📜  js 展开元素 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:07.297000             🧑  作者: Mango

代码示例1
// 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);