Open dbarou55e opened 1 month ago
Inside of a Laravel Livewire component, I dispatch an event to a listener containing some Javacript that calls the .hide() method on the modal. Unfortunately, the modal does not close.
JS code:
document.addEventListener('livewire:load', () => { Livewire.on('closeModal', () => { const myModal = new Modal(document.getElementById('createCustomerModal')); myModal.hide(); }); });
Livewire Componant:
if ($userOrganization) { // Establish the parent-child relationship $userOrganization->children()->attach($organization->id, ['name' => 'some_relation_name']); }
$this->dispatch('closeModal'); $this->reset();
Inside of a Laravel Livewire component, I dispatch an event to a listener containing some Javacript that calls the .hide() method on the modal. Unfortunately, the modal does not close.
JS code:
document.addEventListener('livewire:load', () => { Livewire.on('closeModal', () => { const myModal = new Modal(document.getElementById('createCustomerModal')); myModal.hide(); }); });
Livewire Componant:
if ($userOrganization) { // Establish the parent-child relationship $userOrganization->children()->attach($organization->id, ['name' => 'some_relation_name']); }
$this->dispatch('closeModal'); $this->reset();