HTML DOM tagName property
Example
Get the tag name of the element:
document.getElementById("demo").tagName;
Output result:
P
Try it »
Definition and Usage
The tagName property returns the tag name of an element.
HTML returns the value of the tagName property in uppercase.
Browser support





All major browsers support the tagName property.
Syntax
element
.tagName
Technical Details
| Return Value: | String, representing the tag name of the element. |
|---|---|
| DOM version | Core Level 1 Element Object |
Element object