forked from github/codespaces-blank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
20 lines (17 loc) · 832 Bytes
/
server.js
File metadata and controls
20 lines (17 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.addEventListener("DOMContentLoaded", function () {
const voteButton = document.getElementById("voteButton");
const result = document.getElementById("result");
const electionsDropdown = document.getElementById("elections");
const candidatesDropdown = document.getElementById("candidates");
// Fetch elections and candidates from the server and populate the dropdowns
voteButton.addEventListener("click", function () {
const selectedElection = electionsDropdown.value;
const selectedCandidate = candidatesDropdown.value;
if (selectedElection && selectedCandidate) {
// Send the vote to the server for processing
// Display a confirmation message in result
} else {
result.textContent = "Please select an election and candidate to vote.";
}
});
});