THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM title Property

HTMLElement Object Reference Element Object

Example

Ge the title of an <abbr> element:

var x = document.getElementById("myAbbr").title;

The result of x will be:

World Health Organization
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The title property sets or returns the value of the title attribute of an element.

The title attribute specifies extra information about an element.

The information is most often shown as a tooltip text when the mouse moves over the element.


Browser Support

Property
title Yes Yes Yes Yes Yes

Syntax

Return the title property:

HTMLElementObject.title

Set the title property:

HTMLElementObject.title=text

Property Values

Value Description
text A tooltip text for an element

Technical Details

Return Value: A String, representing the title of the element

Examples

More Examples

Example

Change the title of a <p> element:

document.getElementById("myP").title = "The World's Largest Web Development Site";
Try it Yourself »

Related Pages

HTML reference: HTML title Attribute


HTMLElement Object Reference Element Object