HTML DOM tagNameProperty

元素对象参考手册Element Object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


元素对象参考手册Element Object

Other Extensions