Created
July 21, 2018 16:01
-
-
Save davidsheardown/a45002060c3d95f472d8696d8bc05123 to your computer and use it in GitHub Desktop.
Bootstrap 4 Modal/Popup with external link/url
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
<!-- | |
Bootstrap 4 doesn't have the "remote" option anymore. Little jQuery will get you an external URL in a modal | |
*Note: The "data-remote" attribute specifies the URL to open within the modal | |
--> | |
<button id='abutton' class='buttonopen' data-remote='http://your-url.com'>Click Me</button> | |
<script> | |
$('buttonopen').on('click', '[data-toggle="modal"]', function(){ | |
$($(this).data("target")+' .modal-body').load($(this).data("remote")); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm - This will never run as is. For starters, it seems that $('buttonopen') refers to a class. If so, that is an invalid selector. Where is the rest of the working (and tested) code?