/** * support.js * * Powers the Support page. * * Features: * 1. FAQ accordion * - Loads Q&A pairs from `./data/faq.json`. * - Renders each as a Bootstrap accordion item so only one * answer is open at a time. * * 2. Contact form * - Validates that all fields have been filled in. * - Displays an inline success or error alert above the form. * - Does not currently persist messages; the form is purely a * frontend demonstration (see README / features notes). */ const faqContainer = document.getElementById('faqContainer'); const contactForm = document.getElementById('contactForm'); const contactStatus = document.getElementById('contactStatus'); async function loadFaqs() { try { const response = await fetch('./data/faq.json'); if (!response.ok) { throw new Error(`Failed to load FAQs: ${response.status}`); } const data = await response.json(); renderFaqs(data.faqs); } catch (error) { console.error('Error:', error); faqContainer.innerHTML = `
Unable to load FAQs.
`; } } function renderFaqs(faqs) { faqContainer.innerHTML = ''; faqs.forEach((faq, i) => { const item = document.createElement('div'); item.className = 'accordion-item'; item.innerHTML = `