Choosing a selection results in a full page refresh.
// Get all the popup links and containers
const popupLinks = document.querySelectorAll('.popup-link');
const popups = document.querySelectorAll('.popup');
// Open the popup when its link is clicked
popupLinks.forEach((link, index) => {
link.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the link from going to its href
popups[index].classList.add('open'); // Add the "open" class to the corresponding popup
});
});
// Close the popup when its close button is clicked
popups.forEach((popup) => {
const closeButton = popup.querySelector('.popup-close');
closeButton.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the link from going to its href
popup.classList.remove('open'); // Remove the "open" class from the popup
});
});