Categories
JavaScript Answers

How to dynamically change a web page’s title with JavaScript?

Spread the love

Sometimes, we want to dynamically change a web page’s title with JavaScript.

In this article, we’ll look at how to dynamically change a web page’s title with JavaScript.

How to dynamically change a web page’s title with JavaScript?

To dynamically change a web page’s title with JavaScript, we set its document.title property.

For instance, we write

document.title = "test";

to set the document.title property to 'test' to make the page title ‘test’.

Conclusion

To dynamically change a web page’s title with JavaScript, we set its document.title property.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *