Bootstrap 4 можно ли как то удалить модальное окно?
У меня есть функция, которая рендерит модальное окно, но вот скрыть его проблематично. Нужно у body убирать класс, далее удалять темный фон. Короче очень не комфортно. Может есть у bootsrtap готовая функция, которая удаляет модально окно со страницы?
.modal('toggle')
Manually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. before the shown.bs.modal or hidden.bs.modal event occurs).
Copy
$('#myModal').modal('toggle')
.modal('show')
Manually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.bs.modal event occurs).
Copy
$('#myModal').modal('show')
.modal('hide')
Manually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.bs.modal event occurs).
Copy
$('#myModal').modal('hide')
Всю информацию можно почитать тут: https://getbootstrap.com/docs/4.5/components/modal/
Даже если Вы просто скопируете модальное окно, то у Вас будет кнопка закрытия (не забудьте подключить скрипты bootstrap):