diff --git a/starterOnly/modal.js b/starterOnly/modal.js index 694a848564..2377b23da8 100644 --- a/starterOnly/modal.js +++ b/starterOnly/modal.js @@ -11,6 +11,7 @@ function editNav() { const modalbg = document.querySelector(".bground"); const modalBtn = document.querySelectorAll(".modal-btn"); const formData = document.querySelectorAll(".formData"); +const modalCloseBtn = document.querySelectorAll(".close"); // launch modal event modalBtn.forEach((btn) => btn.addEventListener("click", launchModal)); @@ -20,4 +21,11 @@ function launchModal() { modalbg.style.display = "block"; } +// close modal event +modalCloseBtn.forEach((btn) => btn.addEventListener("click", closeModal)); + +// close modal form +function closeModal() { + modalbg.style.display = "none"; +}