A DOM tree is simply a neatly organized structure of objects. It can be safely assumed that all these objects would have methods and properties that we can use and change.
In the example given below,
try changing the
p tag to
div tag, or any other tag
of your choice. Look at the result
to see how we are using a property
to get the name of the HTML element.
Here, we have used the
method to get the required element.
We have used the
property to identify the type of
tag being used.
We have also used the
to change the text inside the element.
Here’s a list of some of the major DOM methods and properties that can be used on all HTML elements.