How can I modify the existing title to the document with Jquery as mouseover title change like that on facebook title link.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You don't need jQuery.
document.title = 'My new title here';
回答2:
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.
回答3:
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/
回答4:
Try:
document.title = 'title';