Losing Entire Page Dom Running Javascript
This question continues on from this question: Read url and output new javascript src My latest code is: $(document).ready(function () { var oScript = document.createEl
Solution 1:
You cannot use document.write
after the page has finished loading.
You should use jQuery DOM manipulation instead.
Solution 2:
When a document has closed (after load), any call to document.write()
implicitly calls document.open()
(docs). This causes the current document to be completely wiped out in preparation for new document content.
To manipulate the content of an element, use DOM manipulation such as innerHTML
or appendChild
or use jQuery's equivalent methods (since your code shows you already have jQuery loaded up).
Post a Comment for "Losing Entire Page Dom Running Javascript"