категорииструктур.js 469 B

123456789101112131415
  1. const faqQuestions = document.querySelectorAll('.faq-question');
  2. const answerModal = document.querySelector('.answer-modal');
  3. const answerContent = document.querySelector('.answer-content');
  4. faqQuestions.forEach(question => {
  5. question.addEventListener('click', () => {
  6. const answer = question.dataset.answer;
  7. answerContent.innerHTML = answer;
  8. answerModal.style.display = 'block';
  9. });
  10. });
  11. function closeModal() {
  12. answerModal.style.display = 'none';
  13. }