-11 Vote

jQuery: Change the Title of an HTML Page

Question by Compi | 2019-03-07 at 20:43

How can I change the page title of an HTML page with the help of jQuery, even after loading the page? Is that possible?

ReplyPositiveNegative
1Best Answer1 Vote

You can change the title of the page with the help of jQuery as follows:

$(document).prop('title', 'New Title');

However, it is more elegant if you work directly with pure native JavaScript instead, then you do not need jQuery at all:

document.title = "New Title";

This is more efficient because jQuery does nothing else in the background than just to set the value of document.title.
2019-03-08 at 15:25

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.