I'm a beginner to coding and I have a project that is using a Bootstrap 4 modal. Currently, the content is inside the HTML page and I want the content to be generated from an external HTML file. Is this possible?
To clarify it further, what I want is put the HTML code of the modal inside a separate HTML file and load the modal content from there with jQuery/JavaScript when needed, instead of putting it inside my index files.
I currently use this code to make the modal.
if(status){
$('#mMessage').modal()
}
and HTML
<div class="modal fade" id="mMessage" tabindex="-1" role="dialog" aria-labelledby="mMessageLabel">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="mMessageLabel">Requirements Not Met</h4>
</div>
<div class="modal-body">Please select atleast one.</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Any assistance you can provide would be greatly appreciated. Thanks.