jarcas's avatar

document.addEventListener('livewire:load', function () { not triggering

I converted a Laravel 11 project to use Livewire, and it all works except for:

document.addEventListener('livewire:load', function () {
console.log("RAWRRRRRRRRRR");
});

In a component I made.

My app.blade.php file:

Am I doing something wrong? I tried wrapping it in:

window.addEventListener('DOMContentLoaded', function () {

And that doesn't work either

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

In previous versions of Livewire, you could listen for the livewire:load event to execute JavaScript code immediately before Livewire initialized the page. In Livewire 3, that event name has been changed to livewire:init to match Alpine's alpine:init:

1 like

Please or to participate in this conversation.