-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
26 lines (22 loc) · 827 Bytes
/
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
const ratingBtns = document.querySelectorAll('.rating-btn input');
const submitBtn = document.querySelector('#submit');
const thankCard = document.querySelector('#thank-you-card');
const ratingCard = document.querySelector('#rating-card');
let userRating = 0;
ratingBtns.forEach(ratingBtn => {
ratingBtn.addEventListener('click', e => {
e.stopPropagation();
userRating = e.target.value;
console.log(userRating);
})
})
submitBtn.addEventListener('click', e => {
e.preventDefault();
if (userRating != 0) {
document.getElementById('user-rating').innerHTML = userRating;
ratingCard.style.display = 'none';
thankCard.style.display = 'flex';
} else {
alert("C-Chotto matte senpai, you haven't selected anything yet!");
}
});