I would like to change the title of my page based on the name of
for example,
<h1>lorem imsum<h1>
would set the page title to lorem ipsum
I would like to change the title of my page based on the name of
for example,
<h1>lorem imsum<h1>
would set the page title to lorem ipsum
Assuming you want to do it in JS
document.title = document.querySelectorAll('h1')[0].textContent
Where [0]
is indicating that you want the text from the first h1
element. If your h1
will have an id
then use that instead as it will explicit therefore safer.