Here is a code example:
let order_modal = document.getElementById('order');
order_modal.addEventListener('show.bs.modal', function (e) {
bootstrap.Modal.getInstance(order_modal).hide();
}, false);
When I open the modal, it opens, the .hide() method does not work.
If I change event to ‘shown.bs.modal’ it works but modal blinks.
2
Answers
You could use
Event.preventDefault()
to prevent theshow.bs.modal
event from being executed :I am using an event-click button to close :))) I think it is not the best solution but it worked for me.