JavaScript - Use innerHTML as actual html instead of plain text -
when i'm trying change document.documentelement.innerhtml using innerhtml of textarea this:
document.documentelement.innerhtml = document.queryselector('#mytextarea').innerhtml the innerhtml of #mytextarea not used actual html change dom, plain text.
for example: if innerhtml of #mytextarea <p>a paragraph</p>.
then document after loading looks like: <p>a paragraph</p> instead of a paragraph
how should value inside #mytextarea used change dom? (ex. appending new elements)
use .value contents of textarea without being encoded.
document.getelementbyid("documentelement").innerhtml = document.queryselector('#mytextarea').value; <textarea id="mytextarea"> <p>a paragraph</p> </textarea> <div id="documentelement"> </div>