-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (31 loc) · 1.06 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
let questions = document.querySelectorAll('.question');
questions[0].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q1')[1].classList.add('active');
});
questions[1].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q2')[1].classList.add('active');
});
questions[2].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q3')[1].classList.add('active');
});
questions[3].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q4')[1].classList.add('active');
});
questions[4].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q5')[1].classList.add('active');
});
questions[5].addEventListener('click', function() {
removeAnswer();
document.querySelectorAll('.q6')[1].classList.add('active');
});
function removeAnswer() {
let answers = document.querySelectorAll('.answer');
for(let i = 0; i < 6; i++) {
answers[i].classList.remove('active');
}
}