Skip to content
Advertisement

livewire dispatchBrowserEvent is not triggering alert

I have a livewire component which has an update() function to update the component when it changes. The update() function is called and updates the item in the database as required. At the end of this function i run a dispatchBrowserEvent() to confirm the update but the corresponding function in my js file is not being called and thus the alert is not being triggered.

I have been using this method from the docs https://laravel-livewire.com/docs/2.x/events#browser

The livewire component:

JavaScript

its blade file:

JavaScript

in my app.js I have the following:

JavaScript

Advertisement

Answer

So it turned out i hadn’t ran npm run dev so the javascript didn’t exist. after running this all was good.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement