open modal with js
I have created custom page which has a modal , I want to open the modal using js after an event , but I failed , how can I do that using js please , I searched but I didn't get it
21 Replies
heeelp!
@Dennis Koch
Please don't tag people.
maybe this will work. https://livewire.laravel.com/docs/events#dispatching-livewire-events-from-script-tags
Laravel
Events | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
I apologize , I didn't know that I shouldn't tag anyone , and thank you for your effort
Then please read the server #✅┊rules 😉
it didn't work for me , I don't know why
what is the issue?
the modal do not open
does it work?
I don"t want to open it using a button , I want it to open whan I scann a qr code
yep, I know, but this works?
you mean with button
yes
no i tried it now , it does not work
console errors?
I'm sorry for losing your time , I just want to figure out what's the problem and how to resolve it
nothing
if you are running this
It was supposed to work. It is a simple modal test
I cleared the cache and all , this one works now
but this no
without @push('scripts') ? What is the output?
What about this?
You need to check the code step by step to find the issue..
I removed
document.addEventListener('livewire:initialized', () => {
});
and it worked
I did just this line
<script>
@this.dispatch('open-modal', {
id: 'myModal'
});</script>
thank you so much sir