Inline Scripts

You can listen for livewire:load and place any JavaScript there.

We recommend you use AlpineJS for most of your JavaScript needs, but you can use <script> tags directly inside your Templates.

<div>
    <!--- Your component's template --->
    <script>
        document.addEventListener('livewire:load', function () {
            // Your JS here.
        })
    </script>
</div>

Last updated

Was this helpful?