Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Element.title

« Element

The HTMLElement.title property represents the title of the element, the text usually displayed in a 'tool tip' popup when the mouse is over the displayed node.

If a node does not have a title attribute, then the default action is to inherit it from its parent node, which in turn may inherit it from its parent node, etc.

According to bug 264001, setting title to the empty string triggers the default inheriting behavior. To cancel inheritance, title must be set to a non-empty whitespace string.

 <div title="CoolTip>
   <div title="">mouse over here will popup "CoolTip"</div>
   <div title=" ">mouse over here will popup nothing"</div>
 </div>

Syntax

var string = element.title;
element.title = string;

Example

 button1.title = "click to refresh";

Document Tags and Contributors

 Last updated by: teoli,