I'm trying to remove a surrounding div section from the DOM by using the following simple code:
document.getElementById("1").outerHTML = document.getElementById("1").innerHTML;
<p>
Part 1
<div id="1">
<span id ="2">
Part 2
</span>
Part 3
</div>
Part 4
</p>
The expected output applying the script is that all parts are within one single line. However they are not. When I manually remove the div section from the HTML code they are in one line. Any ideas what I'm doing wrong?
Thank you,
Andreas
` tag. You may have to nest `
` tag.