Change Page title Dynamically

I am trying to change Page Title Dynamically,

But, Custom Code isn’t working in Softr Custom Code (Footer, Custom code block, etc…)

Here is the code below,

It works well in debugger(F12) Console,

but, not working in Softr Custom code only.

Thanks in advance : )

image
[Changed Page title by Debugger Console(F12)]

{Custom Code below}

var content_title = document.querySelector (“#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3”).textContent;

document.title = content_title;

[end of code]

You want to do this all along your website or for specific pages?

Hi matthieu_chateau,
i want this for ‘Each’ ‘Specific’ pages.

e.g.)
Contents | (Contents Title)
Q&A | (Q&A Title)
Case | (Case Title)
etc. . .

Just in case but did you add the script tags?
A javascript code starts with <script> and ends with </script>.

yes i did,

i removed <script> and </script> in the Question.

Original Code is below,

<script>

var content_title = document.querySelector (“#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3”).textContent;

document.title = content_title;
</script>

Try this one

<script>
window.onload = function() {
  var content_title = $('#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3').text();
  document.title = content_title;
};
</script>

Okay, I tired that one.

Now, Title does not exist anymore.

title code is now <title> </title>

and page title is URL of the page now.

picture below,

and it also works well with
Chrome Debugger(F12) Console

it shows the console and changes Page title in right way.

It works for me… so I don’t know… I’m stuck here, can you try to add the code in the footer of the page? if it’s not already done

Thanks, I already did it in the footer code.
And new thing is,
it works really well wirhout variables.

The thing is it works for me so I don’t know, or it comes from your browser or there is a conflict with another code

Okay, I’ll figure it out and share the reason why.