From e5ff6e2f6d1a5a44598eef837120f60aa3bad634 Mon Sep 17 00:00:00 2001 From: Joris Bertier Date: Mon, 6 May 2024 07:24:08 -0500 Subject: [PATCH] #1 close modal --- starterOnly/modal.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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() +})