why am I seeing [object Element] instead of the actual element?
JavaScript
1
Posts
1
Posters
4
Views
1
Watching
-
I have the following in script tag before closing body tag:
fetch('./localhost/assets')
.then(response => response.text())
.then(data => {
const parser = new DOMParser();
const xml = parser.parseFromString(data, "application/xml");
console.log(xml);
let title = xml.getElementsByTagName('title')[0];let ytHeader = document.getElementById('YT-header');
ytHeader.innerHTML=title;
console.log(title)
})(the fetch url isn't the real one) in console I see:
Here is my title
yet in my rendered HTML I just get:
[object Element]
have tried using outerHTML to no avail.