Nov 28th, 2022

Dynamically Change Title of a Website With JavaScript

Author Picture

Dhairya Shah

Software Engineer

The document.title attribute can be used to get or modify the document’s current title. When present, the <title> value is automatically used.

In this article, I will show you a simple and easy way to dynamically change the page title.

Using the document.title property

You may set or get the current document’s title using document.title. To do so, you could directly pass the new title to it as a string. By doing so, the title of the document will be changed.


const newTitle = "Title has been changed"
document.title = newTitle


Now you have learned that page title can be changed using document.title attribute.

Thanks for reading

Follow me on Twitter

Thanks for reading!