-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
27 lines (22 loc) · 1.06 KB
/
script.js
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
// Get the form element and confirmation message element
const rsvpForm = document.getElementById('rsvp-form');
const confirmationMessage = document.getElementById('confirmation-message');
const body = document.body;
// Add event listener to the form submission
rsvpForm.addEventListener('submit', (event) => {
event.preventDefault(); // Prevent form submission
// Get the selected attendance value
const attendance = document.getElementById('attendance').value;
// Display confirmation message based on attendance selection
if (attendance === 'yes') {
confirmationMessage.innerHTML = '🎉 Party on! We look forward to seeing you at the GIF Gala!';
body.style.backgroundImage = 'url("https://media.giphy.com/media/l2JHPB58MjfV8W3K0/giphy.gif")';
} else {
confirmationMessage.innerHTML = '😔 We will miss you at the GIF Gala!';
body.style.backgroundImage = 'url("https://media.giphy.com/media/JER2en0ZRiGUE/giphy.gif")';
}
// Show the confirmation message
confirmationMessage.style.display = 'block';
// Reset the form
rsvpForm.reset();
});