-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.js
More file actions
24 lines (19 loc) · 741 Bytes
/
Copy pathmain.js
File metadata and controls
24 lines (19 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const searchInput = document.getElementById('search-input');
const faqQuestions = document.querySelectorAll('.faq-question');
const searchForm = document.getElementById('search-form');
faqQuestions.forEach((question) => {
question.addEventListener('click', () => {
question.nextElementSibling.classList.toggle('show-answer');
});
});
function toggleAnswer(id) {
var answer = document.getElementById("answer" + id);
var toggleIcon = document.querySelector(".faq:nth-child(" + (id + 1) + ") .toggle-icon");
if (answer.style.display === "none") {
answer.style.display = "block";
toggleIcon.textContent = "-";
} else {
answer.style.display = "none";
toggleIcon.textContent = "+";
}
}