betterbrandagency's avatar

Problem with closing a Flash message.

When I close a flash message, depending on which versions of jquery and bootstrap.js I have included, it either doesn't work at all or removes everything in the body.

If I use the newest versions of bootstrap.js and jquery then nothing happens when I hit the 'x' button on the flash message.

When I use the versions Jeffrey is, however, the whole body content gets removed when I hit the 'x' button.

I have had a look through it and I cannot figure out why this is happening, any help would be much appreciated.

<!DOCTYPE html>
<html>
    <head>
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
        <link rel="stylesheet" href="{{ elixir('css/main.css') }}"
        <meta charset="utf-8">
        <title>Document</title>
    </head>
    <body>
        <div class="container">

            @if (Session::has('flash_message'))
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                <div class="alert alert-success">{{ Session::get('flash_message') }}</div>
            @endif
            @yield('content')
        </div>

        <script src="//code.jquery.com/jquery.js"></script>
        <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
        @yield('footer')
    </body>
</html>

Update: I changed out some files and I have figured that it is Bootstrap causing the problem and not jQuery. I think something in Bootstrap might have changed between the newest version and the version that @JeffreyWay is using. Still having the same problem though; can't seem to figure it out!

0 likes
6 replies
lostdreamer_nl's avatar

You are currently using 2 different versions of bootstrap for CSS and JS. Could you first test with the same?

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">    
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

or

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">    
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
1 like
betterbrandagency's avatar

@lostdreamer_nl

They are both currently at version 3.3.6 and it doesn't work still. When they are both at this version the close button doesn't function at all.

d3xt3r's avatar

Are you sure this is the right implementation of bootstrap alert blocks ?

lostdreamer_nl's avatar
Level 53

And then I see your button is outside of the box The correct HTML should be

<div class="alert alert-success alert-dismissible" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    {{ Session::get('flash_message') }}
</div>  
1 like

Please or to participate in this conversation.