現在、ブートストラップ 5 で読み込みダイアログを作成しようとしています。
したがって、私が最初にしたことは、ドキュメントからテスト HTML へのダイアログにコピーすることです。
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog" id = "waitDialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="staticBackdropLabel">Modal title</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Some Stuff.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Understood</button>
</div>
</div>
</div>
</div>
次に、ドキュメントの指示に従ってそれを開こうとするJSを少し書きました
var myModal = document.getElementById('waitDialog');
var modal = bootstrap.Modal.getInstance(myModal)
modal.show();
これは、 https: //getbootstrap.com/docs/5.0/components/modal/#via-javascript のドキュメントから直接来ています。
モーダルがnullなので動かない。私は何を間違っていますか?