Some object with its own properties corresponds to each page tag in JavaScript. This object stores the text of the tag, the values of its attributes, and other useful things. In JavaScript, such objects are called DOM elements.
Let our HTML code have the following tag:
<div id="elem">text</div>
Let the variable elem
contain a reference
to this tag. In this case, the variable elem
will be an object with properties id
and
textContent
. The id
property will
contain the value of the id
attribute of
our tag, and the textContent
property
will contain its text.
In the next lesson, we will learn how to get references to page tags in JavaScript.