How can I change div content with JavaScript?

Assuming you’re not using jQuery or some other library that makes this sort of thing easier for you, you can just use the element’s innerHTML property.

document.getElementById("content").innerHTML = "whatever";

Leave a Comment