I created a document in Javascript using
newdoc = document.implementation.createHTMLDocument('Whatever')
and then I used
newdoc.innerHTML = document.innerHTML
to give him some code. The problem is that the DOM for newdoc doesn't seem to be fully formed and executing a function such as
newdoc.getElementsByClassName('somename')
on it yields undefined results. Do you know a solution for this problem?
document does not have innerHTML property.
You should use it on the body.
newdoc.body.innerHTML = document.body.innerHTML;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With