How do I change the content of a DOM element?

Use:

  • innerHTML

    • This will take the string you pass in and interpret it as HTML.

  • innerText

    • This will not interpret the string you pass in - it will treat any HTML markup as plain text and not try to treat it as HTML.

For example:

var Div = document.querySelector(".SPLASHdiv"); Div.innerHTML = "This is <b>good!</b>";

This is a core technique in Javascript web programming.

See this video to see it in use.