Javascript Document.Write

document write is an antipattern,

use:

function elemTest() {
    var newDiv = document.createElement("div");
    newDiv.innerHTML = "<h1>Hi there!</h1>";
    document.body.appendChild(newDiv);
};

Jason Kulatunga

Devops & Infrastructure guy @Gusto (ex-Adobe). I write about, and play with, all sorts of new tech. All opinions are my own.

San Francisco, CA blog.thesparktree.com

Subscribe to Sparktree

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!