Jump to content

Javascript not working for blog Posts

Recommended Posts

Site URL: https://www.rnatranslation.com/blog

<script>
window.addEventListener("load", function () {
  
document.querySelector("a.sqs-block-button-element").innerText = "Comments";
  
});
  
</script>

Is the code I would like to use to change the comments in the comment section of the blog post

Usually selecting items on other pages like the home page with this exact same process of selection works

But for some reason it doesn't work for blog posts?

The CSS I have seems to work just fine

 

I apologise as the blog posts are unpublished currently 

 

Thank you in advance for any assistance

Screen Shot 2022-08-19 at 5.57.50 am.png

Screen Shot 2022-08-19 at 5.59.23 am.png

Link to comment
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Sorry the code was a template from another page that I was hoping to use as an example

<script>
window.addEventListener("DOMContentLoaded", function () {
  
  document.querySelector("h3.comment-count").innerText = "Comments";
  
});
</script>

I just want to change comments [0] to comments and remove the number on load. The problem is I can't select the element in blog post entries for some reason but with that same code template I can on pages like the home page

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.