Skip to content

Commit

Permalink
OpenClassrooms-Student-Center#1 Close modal onclick associate button
Browse files Browse the repository at this point in the history
  • Loading branch information
GrimonprezAlexis committed Feb 22, 2021
1 parent 74e7ea1 commit 468df08
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions starterOnly/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 modalCloseBtn = document.querySelectorAll(".close");

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

// Close modal form
function closeModal() {
modalbg.style.display = "none";
}

// Close modal event
modalCloseBtn[0].addEventListener ("click", closeModal);

0 comments on commit 468df08

Please sign in to comment.