Easy Tutorial
❮ Prop Track Srclang Prop Document Implementation ❯

Title text Attribute

Title Object

Example

Return the text content of the document's title tag:

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

x Output result:

HTML DOM Objects

Definition and Usage

The text attribute is used to set or return the text content of the document's title element.


Browser Support

All major browsers support the text attribute.


Syntax

Return the text attribute:

Set the text attribute:

Attribute Values

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

Technical Details

| Return Value: | String, returns the text content of the document's title element. | | --- | --- |


More Examples

Example

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

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

Title Object

❮ Prop Track Srclang Prop Document Implementation ❯