Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM tagName property

HTML DOM tagName property

Element Object Reference Element object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 Reference Element object