diff --git a/starterOnly/modal.js b/starterOnly/modal.js index 694a848564..e68301c3bb 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 modalClose = document.querySelector('.close'); // launch modal event modalBtn.forEach((btn) => btn.addEventListener("click", launchModal)); @@ -19,5 +20,12 @@ modalBtn.forEach((btn) => btn.addEventListener("click", launchModal)); function launchModal() { modalbg.style.display = "block"; } +// close modal form +function modalCloseForm(){ + modalbg.style.display = "none"; +} +modalClose.addEventListener('click', ()=> { + modalCloseForm() +})