js change div content code example
Example 1: javascript set text of div
document.getElementById("content").innerHTML = "whatever";
Example 2: js change div content
let element = document.getElementById("test");
let newContent =`
<h1>New Title</h1>
<p>New Content</p>
`;
//changing the content in your element
element.innerHTML = newContent;
Example 3: javascript replace content of div
document.getElementById("test").innerHTML = "new content"