Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Title text property

Title text property

Title Object Reference The Title object

Example

Return the text content of the document title tag:

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

x The output result is:

HTML DOM Objects

Try it »


Definition and usage

The text property is used to set or return the text content of the document title element.


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the text property.


Syntax

Return the text attribute:

titleObject

.text

Set the text attribute:

titleObject

.text=

text

Attribute values

Value Description
text Describes the text content of the document title element.

Technical Details

Return value: String, returning the text content of the document title element.

More examples

Example

Modify the text content of the title element in the document:

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

Try it »


Title Object Reference The Title object