I'm trying to do something similar/same as in this question: How to remove only the parent element and not its child elements in JavaScript?
<div>
This is some text here
<h2>This is more text</h2>
</div>
All I want is to remove the H2 tag. The result should be:
<div>
This is some text here
This is more text
</div>
Assume that I have the H2 element already:
if (parentElement.nodeName.toLowerCase() == "h2") {
//now what? I basically want to this: $.replaceWith(parentElement.innerText)
//just without jQuery
}