how to replace div with new div in javascript code example Example: javascript replace content of div document.getElementById("test").innerHTML = "new content"