# HTML DOM Access
* * *
Access HTML DOM - Find HTML elements.
* * *
## Access HTML Elements (Nodes)
Accessing HTML elements is equivalent to accessing nodes.
You can access HTML elements in different ways:
* Using the getElementById() method
* Using the getElementsByTagName() method
* Using the getElementsByClassName() method
* * *
## getElementById() Method
The getElementById() method returns a reference to the element with the specified ID:
### Syntax
_node_.getElementById(_"id"_);
The following example gets the element with id="intro":
## Example
document.getElementById("intro");
[Try it Β»](#)
* * *
## getElementsByTagName() Method
getElementsByTagName() returns all elements with the specified tag name.
### Syntax
_node_.getElementsByTagName(_"tagname"_);
The following example returns a list of all
elements in the document:
## Example 1
document.getElementsByTagName("p");
[Try it Β»](#)
The following example returns a list of all
elements in the document, and these
elements should be descendants (children, grandchildren, etc.) of the element with id="main":
## Example 2
document.getElementById("main").getElementsByTagName("p");
[Try it Β»](#)
* * *
## The getElementsByClassName() Method
If you want to find all HTML elements with the same class name, use this method:
document.getElementsByClassName("intro");
The example above returns a list of all elements with class="intro":
**Note:** getElementsByClassName() is not valid in Internet Explorer 5, 6, 7, 8.