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:
-
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.
-
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!