You are here: Reference > JavaScript > client-side > HTML DOM > properties > tagName

tagName property

Browser support:
Returns the tag name of the current element.
This property retrieves the tag names in uppercase in HTML and in original case in XML documents. The nodeName property can also be used for getting tag names.

Syntax:

object.tagName;
You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the tag name of the element.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the tagName property:
<button onclick="alert (this.tagName);">Get the tag name of this element!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content