Unwrap an element

Remove the ele element except its children:
// Get the parent node
const parent = ele.parentNode;
// Move all children node to the parent
while (ele.firstChild) {
parent.insertBefore(ele.firstChild, ele);
}
// `ele` becomes an empty element
// Remove it from the parent
parent.removeChild(ele);

See also