Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Close Modal With Laravel Livewire Event #961

Open
dbarou55e opened this issue Sep 13, 2024 · 0 comments
Open

Cannot Close Modal With Laravel Livewire Event #961

dbarou55e opened this issue Sep 13, 2024 · 0 comments

Comments

@dbarou55e
Copy link

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant