THE WORLD'S LARGEST WEB DEVELOPER SITE

Title text Property

❮ Title Object

Example

Return the text of the document's title:

var x = document.getElementsByTagName("TITLE")[0].text;

The result of x will be:

HTML DOM Objects
Try it Yourself »

Definition and Usage

The text property sets or returns the text of the document's title.


Browser Support

Property
text Yes Yes Yes Yes Yes

Syntax

Return the text property:

titleObject.text

Set the text property:

titleObject.text = text

Property Values

Value Description
text Specifies the text of the document's title

Technical Details

Return Value: A String, representing the text of the document's title

More Examples

Example

Change the text of the document's title:

document.getElementsByTagName("TITLE")[0].text = "A new title text..";
Try it Yourself »

❮ Title Object