How can I hide session flash using JQuery in Livewire

What seems to be the problem:

Can’t hide session flash alert after few seconds in JQuery, It works with normal HTML but I can’t figure out how to do it in Livewire with Turbolinks.

Steps to Reproduce:

Here is my JQuery Snippet

$(document).on('turbolinks:load', () => {
  setTimeout(function() {
  }, 300);

Here is my blade alert snippet

@if (session()->has('error'))
    <div id="alert" class="alert alert-danger alert-dismissible fade show mt-2">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <i class="fa fa-times mr-1"></i>
        {{ session('error') }}

Are you using the latest version of Livewire:


Do you have any screenshots or code examples:

PS: All code lives here

document.addEventListener("livewire:load", function(event) {
    window.livewire.hook('afterDomUpdate', () => {
        setTimeout(function() {
        }, 300);

Thanks @dustinfabre It works!