Greetings all! I have the task of changing the accordion style FAQ such that each title also has a button that collapses the answer section below it, much like how the answers do. I am attempting to do this through JavaScript, or CSS. I am not getting the correct results, though I am just recently learning JavaScript and revisiting CSS/HTML from long ago in my college career so the code may be wrong. Here is my JavaScript code:
document.addEventListener(‘DOMContentLoaded’, function () {
// Select all the FAQ title spans
const titles = document.querySelectorAll(‘.eapps-faq-content-category-title-text’);
titles.forEach(title => {
title.addEventListener(‘click’, () => {
// Find the next sibling container (FAQ content) after the title
let content = title.parentElement.nextElementSibling;
if (content) {
// Toggle visibility of the content
const isVisible = content.style.display === 'block';
content.style.display = isVisible ? 'none' : 'block';
}
});
Thanks! Where will I receive notification of the completed solution? I’d love to see how they accomplish this task, because I have others I would like to accomplish myself as well.
In the meantime, we’d be so grateful if you could look through the FAQ category on the Wishlist and upvote the ideas you like most. Your feedback helps us move in the right direction.
And don’t hesitate to add your own ideas - we’ll gladly discuss them with you
Hey @Max ! I have another request for your devs! I have a popup ad widget, but I want to modify it such that it opens up only when the user has scrolled down to a certain portion of the page that has the element with these html tags: span class=“elButtonMainText elButtonText”>Click Here To Learn More About Our Pricing Package</span. Thanks! Please let me know what more information you need. I also do not have access to the main email on this account, if you could just contact me through victor.a.minin@gmail.com, or more preferably through responses on this post. Thanks!!