English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
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‹/›
All browsers fully support the title attribute:
Attribute | |||||
title | Is | Is | Is | Is | Is |
Value | Description |
---|---|
newTitle | The tooltip text of the element |
Return Value: | A string representing the title of the element |
---|---|
DOM Version: | DOM Level1 |
Change the title of <p> element:
document.getElementById("para").title = "Inserted New Title";Test See‹/›
HTML DOM Reference:document.title attribute
HTML Reference:HTML title attribute