English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML DOM title attribute

HTML DOM Element Object

titleThe attribute sets or returns the value of the element's title attribute.

The title attribute specifies suggested information about the element.

When the mouse hovers over an element, the information is usually displayed in the 'tooltip' popup window.

Syntax:

Return the title of the element:

HTMLElement.title

Set the title of the element:

HTMLElement.title = newTitle
var x = document.getElementById("myLink").title;
Test See‹/›

Browser Compatibility

All browsers fully support the title attribute:

Attribute
titleIsIsIsIsIs

Attribute Value

ValueDescription
newTitleThe tooltip text of the element

Technical Details

Return Value:A string representing the title of the element
DOM Version:DOM Level1

More Examples

Change the title of <p> element:

document.getElementById("para").title = "Inserted New Title";
Test See‹/›

Related References

HTML DOM Reference:document.title attribute

HTML Reference:HTML title attribute

HTML DOM Element Object