-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (20 loc) · 805 Bytes
/
Copy pathapp.js
File metadata and controls
25 lines (20 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const rating_score_bubbles = document.querySelectorAll('[data-click]');
const pop_up = document.querySelector('[data-content]');
const button = document.querySelector('[data-submit]');
const card_rating = document.querySelector('.rating-box');
const card_bye = document.querySelector('.thank-you');
let value = undefined;
rating_score_bubbles.forEach((item1) => {
item1.addEventListener('click', (e) => {
rating_score_bubbles.forEach((item2) => {
item2.classList.remove('is_clicked');
});
item1.classList.add('is_clicked');
value = item1.innerHTML;
});
});
button.addEventListener('click', (e) => {
card_rating.classList.add('invisible');
card_bye.classList.remove('invisible');
pop_up.innerHTML = `You selected ${value} out of 5`;
});