Easy Tutorial
❮ Prop Datetime Local Type Met Win Clearinterval ❯

HTML DOM getElementsByTagName() Method

Element Object

Example

Change the text of the first list item in a list:

Before modifying the text:

After modifying the text:

Definition and Usage

The getElementsByTagName() method returns a collection of all elements with a specified tag name.

Note: If the special string "*" is passed to the getElementsByTagName() method, it will return a list of all elements in the document, in the order they appear in the document.


Browser Support

All major browsers support the getElementsByTagName() method.


Syntax

Parameters

Parameter Type Description
tagname String Required. The tag name of the elements you want to get.

Return Value

Type Description
NodeList object The elements are returned in the order they appear in the document.

Technical Details

| DOM Version | Core Level 1 Element Object | | --- | --- |


Element Object

❮ Prop Datetime Local Type Met Win Clearinterval ❯