/
How do I change the content of a DOM element?
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.
, multiple selections available,
Related content
DOM Element
DOM Element
More like this
How do I get a DOM element into a Javascript variable?
How do I get a DOM element into a Javascript variable?
More like this
DOM Elements versus HTML markup
DOM Elements versus HTML markup
More like this
Javascript Object
Javascript Object
Read with this
Simple banner code
Simple banner code
More like this
Iterate through Javascript object
Iterate through Javascript object
Read with this