How to change the text in title using JS?

  • 0
    It's pretty easy to do this in JQuery, but it doesn't work in js.
    document.getElementsByTagName('title').forEach(ass => 
        {
        if (ass.innerText === 'Волга') {
            ass.innerText = 'Ветер';
        }
        });
    JavaScript Anonymous, Oct 23, 2020

  • 3 Answers
  • 0
    document.title = "I'm not a google bummer";
    Chase Stanley

  • 0
    if (document.title === 'Волга') {
    document.title = 'Ветер';
    }
    Hudson Banks

  • 0
    I understand everything, but seriously? Copy-paste your question on Google, the first result: https : //javascript.ru/forum/misc/6096-izmenenie-te ...

    It took me 3 seconds.

    How long did it take you to create this question?
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!