I have a HTML <title> element which I want to dynamically change depending on other elements. I tried using document.getElementsByTagName('title').innerHTML = dynamicContent but this did not seem to work. I have seen it done before, but I can’t seem to figure out exactly how to do this.
I have a HTML <title> element which I want to dynamically change depending on
Share
Do you mean the
<title>element in<head>of the page?If yes, then changing
document.titleshould do the trick.