HTML DOM Element title

Examples

Get the title of an element:

let title = element.title;
Try it Yourself »

Change the title of an element:

element.title = "The World's Largest Web Development Site";
Try it Yourself »

Description

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

The title attribute specifies extra information about an element. It can be shown as a tooltip text when the mouse moves over the element.

Related Pages

The HTML title Attribute



Syntax

Return the title property:

element.title

Set the title property:

element.title = text

Property Value

Value Description
text The value for the element's title attribute.

Return Value

Type Description
StringThe value of the element's title attribute.

Browser Support

element.title is supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.