Created
April 24, 2016 03:04
-
-
Save AlexanderLindsay/f0944a68d187e409480d79b43ebc9430 to your computer and use it in GitHub Desktop.
javascript to load a bootstrap modal content from an anchor tag
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
// boostrap 4 load modal example from docs | |
$('#modal-container').on('show.bs.modal', function (event) { | |
var button = $(event.relatedTarget); // Button that triggered the modal | |
var url = button.attr("href"); | |
var modal = $(this); | |
// note that this will replace the content of modal-content ever time the modal is opened | |
modal.find('.modal-content').load(url); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment