When I'm trying to change document.documentElement.innerHTML
using the innerHTML
of a textarea like this:
document.documentElement.innerHTML = document.querySelector('#mytextarea').innerHTML
The innerHTML
of #mytextarea
is not used as actual HTML to change the DOM, but as plain text.
For example: if the innerHTML
of #mytextarea
is <p>A paragraph</p>
.
Then the document after loading looks like: <p>A paragraph</p>
instead of A paragraph
How should I do it so the value inside the #mytextarea
could be used to change the DOM? (ex. appending new elements)