How to change the title of page through jQuery?

前端 未结 7 870
时光取名叫无心
时光取名叫无心 2020-12-20 11:04

I want to change the title of page dynamically. I have lots of AJAX request going on in my page. On each type of response I want to notify this using the title.

7条回答
  •  暖寄归人
    2020-12-20 11:39

    Why jQuery for such minor task? Use vanilla javascript:

    document.title = "My new title";
    

    More Info:

    • http://homepage.ntlworld.com/kayseycarvey/document2.html

    If you still want to go with jQuery, you simply do:

    $("title").html("My new title");
    

提交回复
热议问题