структура.js 453 B

123456789101112
  1. const faqSections = document.querySelectorAll('.faq-section');
  2. faqSections.forEach(section => {
  3. const title = section.querySelector('.faq-title');
  4. const faqQuestions = section.querySelector('.faq-questions');
  5. const plusIcon = section.querySelector('.fas');
  6. title.addEventListener('click', () => {
  7. faqQuestions.style.display = faqQuestions.style.display === 'block' ? 'none' : 'block';
  8. plusIcon.classList.toggle('fa-minus');
  9. });
  10. });