Well, the example from the docs should work just fine. hide() is not a jQuery method. It is a method on the modal object from Bootstrap 5.
Can you show your code?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
In my app I'm using Bootstrap 5 modal windows to display the forms.
In order to manage validate the fields before to close the form, I want to close / hide the modal window with JavaScript.
In the Bootstrap 5 documentation, it is said that jQuery is not used anymore, so I don't have installed jQuery in my project. Bootstrap 5 proposes to use this code to hide a modal window.
https://getbootstrap.com/docs/5.0/components/modal/#hide
...
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('closeModal', () => {
var modal = new bootstrap.Modal(document.getElementById('authorForm'));
modal.hide();
});
});
This doesn't work ... so I wonder if this hide() method is a jQuery method ?
Or perhaps I have forgotten something ...
If you have any idea ;) ...
Thanks a lot.
Vincent
Are you sure the javascript from bootstrap is loaded? Also, what does var modal contain? Is it pointing to the correct element in de DOM?
Anyway, it doesn't make sense to me to use livewire on one hand and then bootstrap for the javascript part. I would personally just build the model in a livewire component and use it from there.
Please or to participate in this conversation.