W3cubDocs

/DOM

HTMLElement.title

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.

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

Syntax

var str = element.title;
element.title = str;

Example

 button1.title = "click to refresh";

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support ? Yes 1 ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes 4 ? ? ?

See also

  • The HTML title global attribute.

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/title