Latest web development tutorials
 

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

Internet Explorer Firefox Opera Google Chrome Safari

The text property is supported in all major browsers.


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