I want to change the tab name every few seconds like it says CEO ONLY then 3 seconds later it changes it ADMIN OR CEO LOGIN. Then repeat constantly.
That would involve using setInterval and document.title
window.setInterval(function () {
...
}, 3000);
In the setInterval we can check if the title is already “CEO ONLY”, and if it is we can assign that other string as the title.
const title = (
document.title === "CEO ONLY"
? "ADMIN OR CEO LOGIN"
: "CEO ONLY"
);
...
Lastly we can set the document title to the desired title.
document.title = title;
1 Like
just checking I used this for another one of my projects it is not doing anything
window.setInterval(function () {
const title = (
document.title === "Upright Code"
? "SERVICE IS NOT AVALIBLE"
: "WEBSITE UNDER CONSTRUCTION"
);
}, 3000);
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.