I have a problem in Livewire 2 when the modal close the page is disabled,
document.addEventListener('livewire:load', function () {
Livewire.on('success', function () {
$('#kt_modal_add_user').modal('hide');
window.LaravelDataTables['users-table'].ajax.reload();
});
});
public function submit()
{
$this->emit('success', __('New user created'));
$this->reset();
}
<div class="modal fade" id="kt_modal_add_user" tabindex="-1" aria-hidden="true" wire:ignore.self>
Any help?
Hi Moaz,
May I know if you already have customise the existing Laravel? This behavior might be due to the modal not being properly hidden or other JavaScript conflicts. Here are some steps to troubleshoot the issue:
Double-check that the modal is being properly hidden when you call $('#kt_modal_add_user').modal('hide');. Ensure that the modal ID matches the actual ID of your modal element.
Look in your browser's developer console for any JavaScript errors that might be causing issues. These errors can sometimes interfere with Livewire components.
Add console.log statements in your JavaScript code to debug the issue. For example, you can add console.log('Modal closed'); after $('#kt_modal_add_user').modal('hide'); to see if it's being executed as expected.
Thanks