Change the text of the first list item in a list:
Before changing the text:
After changing the text:
The getElementsByTagName() method returns a collection of an elements's child elements with the specified tagname, as a NodeList object.
Read more about the NodeList object in our NodeList object reference.
Tip: The parametervalue "*" returns all of the element's child elements.
![]()
The getElementsByTagName() method is supported in all major browsers.
| Parameter | Type | Description |
|---|---|---|
| tagname | String | Required. The tagname of the child elements you want to get |
| Type | Description |
|---|---|
| NodeList object | A collection of the element's child elements with the specified tagname |
| DOM Version | Core Level 1 |
|---|
Your message has been sent to W3Schools.