W3Schools.com
THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPJQUERYBOOTSTRAPANGULARXML
 

HTML DOM title Property

Document Object Reference Document Object

Example

Get the title of the current document:

var x = document.title;

The result of x will be:

My 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

Examples

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 Reference Document Object