-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscript.js
66 lines (45 loc) · 1.76 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
//Selectors
let homeScoreEl = document.getElementById("home-score");
let guestScoreEl = document.getElementById("guest-score");
let homeScoreBtnOne = document.getElementById("home-score-btn-1");
let homeScoreBtnTwo = document.getElementById("home-score-btn-2");
let homeScoreBtnThree = document.getElementById("home-score-btn-3");
let resetHomeScore = document.getElementById("reset-home-score");
let resetGuestScore = document.getElementById("reset-guest-score");
let guestScoreBtnOne = document.getElementById("guest-score-btn-1");
let guestScoreBtnTwo = document.getElementById("guest-score-btn-2");
let guestScoreBtnThree = document.getElementById("guest-score-btn-3");
// === Button Function - Home === \\
// Button - 1 - Home
homeScoreBtnOne.addEventListener("click", function () {
homeScoreEl.textContent++;
});
// Button - 2 - Home
homeScoreBtnTwo.addEventListener("click", function () {
homeScoreEl.textContent = Number(homeScoreEl.textContent) + 2;
});
// Button - 3 - Home
homeScoreBtnThree.addEventListener("click", function () {
homeScoreEl.textContent = Number(homeScoreEl.textContent) + 3;
});
// Reset - Home
resetHomeScore.addEventListener("click", function () {
homeScoreEl.textContent = 0;
});
// === Button Function - Guest === \\
// Button - 1 - Guest
guestScoreBtnOne.addEventListener("click", function () {
guestScoreEl.textContent++;
});
// Button - 2 - Guest
guestScoreBtnTwo.addEventListener("click", function () {
guestScoreEl.textContent = Number(guestScoreEl.textContent) + 2;
});
// Button - 3 - Guest
guestScoreBtnThree.addEventListener("click", function () {
guestScoreEl.textContent = Number(guestScoreEl.textContent) + 3;
});
// Reset - Guest
resetGuestScore.addEventListener("click", function () {
guestScoreEl.textContent = 0;
});