Last active
July 8, 2020 22:36
-
-
Save sanatem/cbc119c8cddb71bfc6730e80b6422352 to your computer and use it in GitHub Desktop.
Dynamically fill modals ver 2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".modal-btn").click(function (event) { | |
// Get the modal | |
event.preventDefault(); | |
modal = document.getElementById(event.target.closest("button").dataset.modal); | |
modal.style.display = "block"; | |
}); | |
// When the user clicks on (x), close the modal | |
$(".close").click(function (event) { | |
modal = event.target.closest(".modal"); | |
modal.style.display = "none"; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment