X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook