我正在尝试使这个模态不可知(假设我有 30 个模态窗口)
HTML:
<div class="aaa"> Modal One</div>
<div class="my-modal modal-class">
<div class="modal-body">
aaa 1
</div>
</div>
<div class="aaa"> Modal Two</div>
<div class="my-modal modal-class">
<div class="modal-body">
aaa 2
</div>
</div>
jQuery:
$(".aaa").click(function (e) {
var thisDiv = $(this).closest("#my-modal").first();
modalLaunch(thisDiv); / doesn't work - I'm trying to grab next hidden modal after the link is clicked.
// modalLaunch("my-modal") - works just fine;
});
代码根据注释编辑