So what happens ? Error in the console?
Sep 2, 2022
10
Level 20
How to hide session flash msg
My flash msg using Jquery to hide it after a specific time
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Student</title>
</head>
<body>
<main>
@yield('content')
</main>
<footer class="flex justify-end" id="flashmsg">
@if (session()->has('success'))
<div class="fixed text-white bg-blue-500 rounded-lg shadow bottom-3 text-lg py-2 px-2 mr-5" id="successMessage">
<p>{{ session('success')}}</p>
</div>
@endif
</footer>
<script>
setTimeout(function() {
$('#successMessage').remove();
}, 30000);
</script>
</body>
</html>
Level 102
See if the timeout is run
<script>
setTimeout(function() {
alert('timeout ran')
$('#successMessage').remove();
}, 30000);
</script>
Please or to participate in this conversation.