Title text Attribute

Definition and Usage

text Attribute to set or return the text of the document title.

See also:

HTML Reference Manual:HTML <title> Tag

Instance

Example 1

Return the text of the document title:

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

Try It Yourself

Example 2

Change the text of the document title:

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

Try It Yourself

Syntax

Return text attribute:

titleObject.text

Set text attribute:

titleObject.text = text

Attribute Value

Value Description
text Specifies the text of the document title.

Technical Details

Return Value: A string value representing the text of the document title.

Browser Support

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