Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ const totalParticipants = document.getElementById('totalParticipants');
+ const totalSchools = document.getElementById('totalSchools');
+ const totalEvents = document.getElementById('totalEvents');
+ const joinForm = document.getElementById('joinForm');
+
+ let participants = 0;
+ let schools = new Set();
+ let events = 0;
+
+ function updateStats() {
+ totalParticipants.textContent = participants;
+ totalSchools.textContent = schools.size;
+ totalEvents.textContent = events;
+ }
+
+ joinForm.addEventListener('submit', function(event) {
+ event.preventDefault();
+ const name = document.getElementById('name').value;
+ const school = document.getElementById('school').value;
+
+ participants++;
+ schools.add(school);
+ events++;
+
+ updateStats();
+ joinForm.reset();
+ });
+
+ updateStats();
+ });