Why cant I append pasted html with appendChild? This is my code:
<div id="byeeee"></div>
var appenddescription = $.parseHTML("<h1>hello</h1> bye<br>");
document.getElementById("byeeee").appendChild(appenddescription);
My goal is to parse the html and append it to the div. When I try the code above I get the following error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
I tried to use this answer https://stackoverflow.com/a/31800768/15677215 but it didnt help
P.S: I'm using Jinja as a templating engine. In my real code the JavaScript would look like
var appenddescription = $.parseHTML("{{hello}}");
hello
bye`` (literally) the
's dont make a new line. If it helps, Im using the templating engine Jinja to generate whats in parseHTML() . Appending does work though – mcdonalds291 May 16 '21 at 03:55