forked from GCA-Classroom/05-prj-intel-event-check-in
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (29 loc) · 1.07 KB
/
Copy pathscript.js
File metadata and controls
38 lines (29 loc) · 1.07 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
// Get all needed DOM elements
const form = document.getElementById("checkInForm");
const nameInput = document.getElementById("attendeeName");
const teamSelect = document.getElementById("teamSelect");
// Count attendance
let count = 0;
const maxCount = 50;
//Handle Form Submission
form.addEventListener("submit", function(event) {
event.preventDefault();
// Get input values
const name = nameInput.value;
const team = teamSelect.value;
const teamName = teamSelect.selectedOptions[0].text;
console.log(name, teamName);
// Increment Conut
count++;
console.log("Total Chech-ins:", count);
//Update the progress bar
const percentage = Math.round((count / maxCount) * 100) + "%";
console.log("Progress:", percentage);
const teamCounter = document.getElementById(team + 'Count');
teamCounter.textContent = parseInt(teamCounter.textContent) + 1;
const message = document.getElementById("greeting");
message.style.display = "block";
message.textContent = `Welcome ${name} from ${teamName}!`;
console.log(`Welcome ${name} from ${teamName}!`);
form.reset();
})