Latest web development tutorials

HTML DOM tagName property

Elements Object Reference Element object

Examples

Get the element tag name:

document.getElementById("demo").tagName;

Output:

P

try it"

Definition and Usage

tagName property returns the tag name of the element.

HTML tagName returns the value of the property is capitalized.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support tagName property


grammar

element .tagName

technical details

return value: Label name string that represents the elements
DOM version Core Level 1 Element Object


Elements Object Reference Element object