我复制了模态按钮,问题是我无法在我的代码中显示“打开模态 2”。
<button id="myBtn">Open Modal</button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
</div>
这是我的完整代码: https://jsfiddle.net/dedi_wibisono17/xn3npwc4/
我该怎么办?谢谢你
最佳答案
您应该为“Open Modal 2”元素使用不同的 ID。
根据 W3School 的定义和用法,
getElementById() 方法访问具有指定 id 的第一个元素。
关于javascript - 无法创建多个按钮模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36213429/