Answer the question
In order to leave comments, you need to log in
Bootstrap modal only loads content once. What is the problem?
Links that call the modal window
<a data-toggle="modal"
data-target="#a-modal"
href="<?=Url::to(['/admin/buildings/update','id'=>1])?>"
><span class="glyphicon glyphicon-cog"></span></a>
<a data-toggle="modal"
data-target="#a-modal"
href="<?=Url::to(['/admin/buildings/update','id'=>2])?>"
><span class="glyphicon glyphicon-cog"></span></a>
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" id="a-modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
</div>
</div>
</div>
$("#a-modal").on("show.bs.modal", function(e) {
var link = $(e.relatedTarget);
$(this).find(".modal-content").load(link.attr("href"));
});
Answer the question
In order to leave comments, you need to log in
There was a similar problem in the 1st project. Solved it like this:
jQuery(document).ready(function () {
$('.modal').on('hidden.bs.modal', function (e) {
$(this).removeData('bs.modal');
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question