Usually we use data-target=\"#myModal\" in the to open a modal. Right now I need use codes to control when to open the modal.
data-target=\"#myModal\"
This is one way I found. You can add a hidden button:
Open Modal
Then use the code to "click" the button to open the modal:
document.getElementById("openModalButton").click();
This way can keep the bootstrap style of the modal and the fade in animation.