HTML DOM Element title attribute

Definition and usage

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

title The attribute can specify additional information about the element. When the mouse is over the element, it can be displayed as tooltip text.

See also:

HTML title egenskab

Example

Example 1

Get the element's title:

let title = element.title;

Try it yourself

Example 2

Change the element's title:

element.title = "The World's Largest Web Development Site";

Try it yourself

Syntax

Return the title attribute:

element.title

Set the title attribute:

element.title = text

attribute value

value description
text the value of the title attribute of the element.

return value

type description
string the value of the title attribute of the element.

browser support

All browsers support element.title

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support