FAQs could not open properly

I use the free FAQs section downloaded from Shopify section store. But not all FAQs questions could be open properly.

Has anyone run into this issue before? Is there something in the code that needs to be looked at?

Here is a link to the page: https://peddiy.com/pages/faqs

Thank you!

Hello @peddiy_yang , I see that all the FAQs work fine with the first 1 FAQ of Photo Questions and others are not working. The reason is that in this FAQ the input tags attribute β€œid” is getting duplicated(repeated) with all the blocks of the FAQ input and also the input label attribute β€œfor” which changes with the β€œid” of input. It must be unique for all the input β€œid” and according to β€œid” also input label attribute is the same as that. Please make these attributes unique.

Please see the screenshot below. I set the attribute of input β€œid=tab11” and label attribute β€œfor=tab11” and it works fine!!

Feel free to reach out if you have any questions or need assistance.
Best regards,
Darshan

Hi there,

I took a look at your FAQ page and noticed a couple of issues that might be causing the problem:

  1. Duplicate ID Attributes: It looks like some elements on your page are using the same ID attribute. IDs should be unique for each element to function correctly. Check your code to ensure each FAQ item has a unique ID.

  2. Use of Input Elements: It appears you are using input elements for your FAQ sections. While this might work, it’s not the best practice. Consider using elements or other semantic HTML elements that are better suited for toggling content.

If you need further assistance with fixing these issues, feel free to let me know!

To expand the @Darshanp712 diagnosis – here is the liquid part of your section code:


    #  {{ section.settings.heading }} 
    
        {%for block in section.blocks %}
        

            
            
            
{{block.settings.answer}}

        

        {% endfor %}
    

  

Here is how need to modify it:


    ##  {{ section.settings.heading }} 
    
        {%for block in section.blocks %}
        

            
            
            
{{block.settings.answer}}

        

        {% endfor %}
    

  

You’re basically replacing tab{{ forloop.index }} with tab{{ section.id}}-{{ forloop.index }}. This will make your ids unique even if you add multiple FAQ sections on one page.

I’ve also replaced h1 with h2 (you do not want to have multiple H1 elements on a page).

You should add a separate section with H1 element at the top of the page

thank you for your support!