Change Title With Javascript

随声附和 提交于 2019-11-29 13:24:02

You don't need jQuery.

document.title = 'My new title here';

With javascript. jQuery won't help you here:

document.title = 'New Title';

You can insert that into a jQuery mouseover callback function if you want.

Toby

I'll extend on these other answers, this code should do it in entirety, just be sure to change the class in the selector, and the new Title Text.

(function(){
    var oldtitle;
    jQuery('a.yourlink').hover(
        function () {
           oldtitle = document.title;
           document.title = 'Your New Title';
        },
        function () {
            document.title = oldtitle;
        }
    );
})();

Here is a jsfiddle demo I made that changes the text of the object, rather than the window title: http://jsfiddle.net/MpZGf/1/

Try:

document.title = 'title';
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!