我正在尝试为 jQuery 创建一个数组,以便下面的代码适用于从 #myModal 到 #myModal40 的所有 div ID
jQuery(".modal-backdrop, #myModal, .close, #myModal .btn").live("click", function() {
jQuery("#myModal iframe").attr("src", jQuery("#myModal iframe").attr("src"));
});
HTML
<!-- Button trigger modal -->
<a class="btn btn-primary btn-lg" href="#myModal" data-toggle="modal">Play - Video</a>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><button class="close" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title">Introduction</h4>
</div>
<div class="modal-body"><iframe src="//www.youtube.com/embed/AosdkSA" height="315" width="530" allowfullscreen="" frameborder="0"></iframe></div>
</div>
</div>
</div>
<a class="btn btn-primary btn-lg" href="#myModal2" data-toggle="modal">Play - Video</a>