我想使用javascript动态地将内容添加到bootstrap 4模态,所以我不必为每个div创建一个唯一的模态。
我对javascript还是很陌生,所以我不太确定该怎么做。我想分别抓取图像,.hs-logo-text和.hs-inner-text。
<div class="col-md-3">
<a data-toggle="modal" data-target="#hsModal" href="#" class="hs-logo-circle">
<img src="/img/img1.png" alt="">
<span class="hs-logo-text">Header 1</span>
<div class="hs-inner-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio eos pariatur labore iure, eveniet, libero quasi ab, reiciendis veniam veritatis non! Adipisci quia nostrum dolorem? Optio animi iste numquam necessitatibus quaerat ipsam qui doloremque porro dicta! Accusamus fugit perspiciatis minus, sequi maiores quis libero facere tenetur suscipit molestias eius at!</div>
</a>
</div>
因此,每个模式都会在每个div中弹出并显示唯一内容。