使用Jquery更改页面标题
问题描述:
如何使用jquery进行动态更改< title>
标记?
How to make dynamic changing <title>
tag with jquery?
示例:添加3 >
符号逐一
example: adding 3 >
symbols one by one
> title
>> title
>>> title
答
$(document).prop('title', 'test');
这只是一个JQuery包装器:
This is simply a JQuery wrapper for:
document.title = 'test';
要定期添加>,您可以这样做:
To add a > periodically you can do:
function changeTitle() {
var title = $(document).prop('title');
if (title.indexOf('>>>') == -1) {
setTimeout(changeTitle, 3000);
$(document).prop('title', '>'+title);
}
}
changeTitle();