-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindexScript.js
More file actions
21 lines (18 loc) · 765 Bytes
/
Copy pathindexScript.js
File metadata and controls
21 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function verifyAndSubmit() {
// Get values from the form elements
const name = document.getElementById('name').value;
const age = parseInt(document.getElementById('age').value);
const citizenship = document.getElementById('citizenship').value;
// Check eligibility conditions
const isEligible = age >= 18 && citizenship === 'US' && jsonData.isValid;
console.log(jsonData.isValid)
// If eligible, redirect to voting.html
if (isEligible) {
alert('You are eligible! Redirecting to voting.html...');
window.location.href = 'voting.html';
return false; // Prevent the form from submitting
} else {
alert('You are not eligible.');
return false; // Prevent the form from submitting
}
}