amritanan Posted March 22, 2021 Share Posted March 22, 2021 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
Beyondspace Posted March 23, 2021 Share Posted March 23, 2021 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
amritanan Posted March 24, 2021 Author Share Posted March 24, 2021 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.