Untitled

 avatar
unknown
plain_text
15 days ago
571 B
2
Indexable
function submitVote() {
  const form = document.getElementById('votingForm');
  const selectedCandidate = form.querySelector('input[name="candidate"]:checked');

  if (selectedCandidate) {
    document.getElementById('voteResult').style.display = 'block';
    // Optionally, you can also log the selected candidate or process the vote further
    console.log("Vote submitted for: " + selectedCandidate.value);
    form.reset(); // Reset the form after submitting the vote
  } else {
    alert('Please select a candidate before submitting your vote.');
  }
}
Editor is loading...
Leave a Comment