-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
78 lines (58 loc) · 2.2 KB
/
script.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Assigning Variables
const buttons = document.querySelectorAll('.buttons');
const thankYou = document.getElementById('num-select');
const submit = document.querySelector('.s-button');
const finalResult = document.querySelector('.wrapper-2');
const pageOne = document.querySelector('.wrapper');
buttons.forEach(element => {
element.addEventListener('click', () => {
for(i=0; i < buttons.length; i++) {
buttons[i].classList.remove('active');
}
element.classList.toggle('active');
thankYou.innerText = `You selected ${element.innerText} out of ${buttons.length++}.`;
})
});
submit.addEventListener('click', () => {
pageOne.style.display = 'none';
finalResult.style.display = 'flex';
})
// let wrapper = document.getElementsByClassName('wrapper');
// let wrapperTwo = document.getElementsByClassName('wrapper-2');
// let selectedRating = 0;
// let button = document.getElementsByClassName('s-button');
// let rateContainerOne = document.getElementsByClassName('rate-container1');
// let rateContainerTwo = document.getElementsByClassName('rate-container2');
// let rateContainerThree = document.getElementsByClassName('rate-container3');
// let rateContainerFour = document.getElementsByClassName('rate-container4');
// let rateContainerFive = document.getElementsByClassName('rate-container5');
// let ratingSelectionText = document.getElementById('num-select')
// rateContainerOne.addEventListener('click', () => {
// selectedRating = 1;
// showThis();
// })
// rateContainerTwo.addEventListener('click', () => {
// selectedRating = 2;
// showThis();
// })
// rateContainerThree.addEventListener('click', () => {
// selectedRating = 3;
// showThis();
// })
// rateContainerFour.addEventListener('click', () => {
// selectedRating = 4;
// showThis();
// })
// rateContainerFive.addEventListener('click', () => {
// selectedRating = 5;
// showThis();
// })
// function showThis() {
// if(selectedRating !== 0) {
// let submitValue = document.getElementById('rate-value');
// button.addEventListener('click', () => {
// wrapper.style.display = none;
// wrapperTwo.style.display = block;
// })
// }
// }