-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
80 lines (71 loc) · 2.91 KB
/
index.html
File metadata and controls
80 lines (71 loc) · 2.91 KB
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
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Overpass:ital@0;1&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<title>JS ASSIGNMENT</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container" class="main-box">
<div class="star">
<img src="/interactive-rating-component-main/images/icon-star.svg" alt="star">
</div>
<div class="text">
<h1>how did we do?</h1>
<p> Please let us know how we did with your support <br>request. All feedback is appreciated
to help us <br>improve our offering!</p>
</div>
<div class="button-container">
<button id="button1" class="btn">1</button>
<button id="button2" class="btn">2</button>
<button id="button3" class="btn">3</button>
<button id="button4" class="btn">4</button>
<button id="button5" class="btn">5</button>
</div>
<button id="submit-btn">SUBMIT</button>
</div>
<div id="second" class="second-container">
<div class="image">
<img src="/interactive-rating-component-main/images/illustration-thank-you.svg" alt="">
</div>
<button id="select"> You selected <span id="score">4 </span> out of 5</button>
<div class="thanks">
<h1>Thank you!</h1>
<p> We appreciate you taking the time to give a rating. <br>If you ever need more support,
don’t hesitate to <br>get in touch!</p>
</div>
</div>
<script>
const secondContainer = document.getElementById("second")
// secondContainer.style.visibility = 'hidden';
secondContainer.style.display = 'none';
let isBtnClicked = undefined;
const buttons = document.querySelectorAll('button');
buttons.forEach(button => {
button.addEventListener('click', () => {
if (button.id !== 'submit-btn') {
console.log(`Button clicked: ${button.textContent}`);
isBtnClicked = button.textContent;
}else{
if (isBtnClicked === undefined) {
alert("Please select a number");
}else{
const generalContainer = document.getElementById("container");
// generalContainer.style.visibility = 'hidden';
generalContainer.style.display = 'none';
// For the last container , to make it
const scoreContainer = document.getElementById('score')
scoreContainer.innerText = isBtnClicked
secondContainer.style.display = 'block';
}
}
});
});
</script>
<!-- // <script src="index.js"></script> -->
</body>
</html>