Javascript – Changing the page title with Jquery

javascriptjquerytitle

How to make dynamic changing <title> tag with jquery?

example: adding 3 > symbols one by one

> title
>> title
>>> title

Best Answer

$(document).prop('title', 'test');

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();