Skip to content

Commit

Permalink
Fixes OpenClassrooms-Student-Center#1: modal btn now closes the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
KpryKorn committed Jan 11, 2024
1 parent b0b5536 commit f2dc91f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function editNav() {
const modalbg = document.querySelector(".bground");
const modalBtn = document.querySelectorAll(".modal-btn");
const formData = document.querySelectorAll(".formData");
const closeBtn = document.getElementById("closeBtn");

// launch modal event
modalBtn.forEach((btn) => btn.addEventListener("click", launchModal));
Expand All @@ -20,4 +21,5 @@ function launchModal() {
modalbg.style.display = "block";
}


// close modal form
closeBtn.addEventListener("click", () => (modalbg.style.display = "none"));

0 comments on commit f2dc91f

Please sign in to comment.