HTML DOM tagNameProperty
Examples
Get the tag name of an element:
document.getElementById("demo").tagName;
Output result:
P
Try it Yourself »
Definition and Usage
The tagName property returns the tag name of an element.
In HTML, the value returned by the tagName property is in uppercase.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the tagName property
Syntax
element.tagName
Technical Details
| Return value: | A string representing the tag name of the element |
|---|---|
| DOM Version | Core Level 1 Element Object |
Other Extensions
Element Object