What is the correct way to write HTML using Javascript? - Stack Overflow - 0 views
-
document.write() will only work while the page is being originally parsed and the DOM is being created. Once the browser gets to the closing </body> tag and the DOM is ready, you can't use document.write() anymore.
-
Using innerHTML on a node:
-
var node = document.getElementById('node-id'); node.innerHTML('<p>some dynamic html</p>');