- HTML elements have properties that are basically changeable values.
- In DOM HTML elements are classified as objects.
innerHTMLproperty is the simplest way to display something inside an element.
Theory is great, but we recommend digging deeper!
<p> element using the
getElementById method and grabbing the
<p> element's id
<p> element's content is manipulated using the
document.getElementById("example").innerHTML = "Hi there!";
Note: you can use the innerHTML property to change all of the HTML elements' content. This works for <html> and <body> tags, too.
- Displaying content in an element is most easily and commonly performed by using the
innerHTMLproperty. You can learn more about using it here.