-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
56 lines (37 loc) · 1.68 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
const subBtn = document.getElementById('sub-btn');
const infinity = document.getElementById('infinity');
const ratingBtns = document.querySelectorAll('.selector');
// HIGHLIGHTING THE BUTTONS ON CLICK
ratingBtns.forEach(btn => {
btn.addEventListener('click', function() {
ratingBtns.forEach(btn => btn.classList.remove('active'));
btn.classList.add('active');
})});
// THANK YOU BOILERPLATE
const paymentImg = 'images/payment.png';
subBtn.addEventListener('click', function(e) {
const userRating = document.querySelector('.selector.active').innerHTML;
const canvas = document.getElementById('canvas');
// console.log(document.querySelector('.selector.active').innerHTML)
infinity.style.display = 'block';
setTimeout(() => {
canvas.innerHTML =
`<main class="card" >
<img src=${paymentImg} class="payment-img" alt="online payment image"/>
<div class="rating-result-container">
You selected ${userRating} out of 5
</div>
<div class="thanks">
Thank you!
</div>
<div class="para-conf">
We appreciate you taking the time to give a rating. If
you ever need more support, don't hesitate to get in touch!
</div>
</main>
<footer class="footer-container">
Challenge by <a href="https://www.frontendmentor.io?ref=challenge" target="_blank">Frontend Mentor</a>.
Coded by <a href="https://github.com/cdanderson76" target="_blank">Clifford Anderson</a>.
</footer>`
}, 2500);
})