HTML DOM title Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM title Property

❮ Document Object

Example

Get the title of the current document:

var x = document.title;
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The title property sets or returns the title of the current document (the text inside the HTML title element).


Browser Support

Property
title Yes Yes Yes Yes Yes

Syntax

Return the title property:

document.title

Set the title property:

document.title = newTitle

Property Values

Value Description
newTitle Specifies a new title text

Technical Details

Return Value: A String, representing the title of the document
DOM Version Core Level 2 Document Object

More Examples

Example

Change the title of the document:

document.title = "Some new title text";
Try it Yourself »

Related Pages

HTML reference: HTML <title> tag

JavaScript reference: HTML DOM Title Object


❮ Document Object