Created
September 13, 2016 15:51
-
-
Save kdarty/26ae8788c9bf2d1891aaf13d53b63cdc to your computer and use it in GitHub Desktop.
Here's a good example of how to run code as a Bootstrap Modal Loads. This is good for when you are remotely loading content into a Bootstrap Modal and want to execute some code against the newly loaded DOM. Simply add a callback function to your jQuery 'load' method that will fire once the content is loaded.
This file contains hidden or 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
// Source Discussion: https://github.com/twbs/bootstrap/issues/5169 | |
$('#do-modal').click(function(e) { | |
e.stopPropagation(); | |
$('#foo .modal-body').load(this.href, function(response, status, xhr) { | |
/* do something cool */ | |
$('#foo').modal(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment