Search w3schools.com:

SHARE THIS PAGE

DOM Element tagName Property

Element Object Reference Element Object

Example

Get the tagName of an element:

document.getElementById("demo").tagName;

The result will be:

P

Try it yourself »

Definition and Usage

The tagName property returns the tag name of the element.

In HTML the returned value of the tagName property is always in UPPERCASE.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The tagName property is supported in all major browsers.


Syntax

element.tagName

Technical Details

Return Value: A String, representing the tag name of the element
DOM Version Core Level 1


Element Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]