Skip to content

Commit

Permalink
Create script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
S2030c authored Oct 2, 2024
1 parent 9f9a879 commit dd11e4a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.addEventListener("DOMContentLoaded", () => {

const openModalButtons = document.querySelectorAll('.open-modal'),
modal = document.querySelector('.alert'),
closeModalButtons = document.querySelectorAll('.close-icon');

openModalButtons.forEach(openBtn => {
openBtn.addEventListener('click', openModal)
});

closeModalButtons.forEach(closeBtn => {
closeBtn.addEventListener('click', closeModal)
});

function openModal() {
modal.classList.add('visible');
}

function closeModal() {
modal.style.display = 'none';
}

});

0 comments on commit dd11e4a

Please sign in to comment.