I have grabbed the contents of a HTML file which i want to append to an element.
The contents of the HTML is shown like this:
console.log(data);
Output:
<style>
.data{
position:relative;
width:100%;
height:100%;
}
</style>
<div id="data">
</div>
I then append it to a parent element like this:
function merge(data,id){
var el = document.getElementById(id);
console.clear();
console.log(el);
console.log(data);
el.appendChild(data);
}
The output for el
does show the correct element that I am trying to append to.
But i seem to get this error:
Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
What does the error mean, and how do I correct the error?