Jump to content

javascript help

Recommended Posts

Hi,

I'm not a javascript girl, but I am trying to write some code to hide/display sections when clicking on different buttons. My question is how can I get an array of all the section ids on a page?

It was easy to hide/display sections when I knew the section ids, but I want to create it without hardcoding the section ids so that the client can use it as a template. 

Thank you!

Link to comment
  • Replies 2
  • Views 676
  • Created
  • Last Reply
4 hours ago, amritanan said:

Hi,

I'm not a javascript girl, but I am trying to write some code to hide/display sections when clicking on different buttons. My question is how can I get an array of all the section ids on a page?

It was easy to hide/display sections when I knew the section ids, but I want to create it without hardcoding the section ids so that the client can use it as a template. 

Thank you!

Without the name (unique id) it's hard to know which is the section to hide, could you share more detail about your ideas?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace
🚀 Learn how to rank new pages on Google in 48 hours!

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
On 3/22/2021 at 8:53 PM, bangank36 said:

Without the name (unique id) it's hard to know which is the section to hide, could you share more detail about your ideas?

Thank you! I was trying to create "tabs" on a page - I first thought I would need to get all the section ids, but I was able to do it using the nth-of-type selector for the sections.

For example - on Button 1 click - show section 2, hide sections 3 and 4.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • 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.