警告关闭-不关闭,点击关闭按钮,启动laravel

时间:2019-05-28 13:06:36

标签: laravel twitter-bootstrap bootstrap-4 laravel-5.8

当我单击关闭按钮时,它不会关闭通知。我想念什么吗?

(警报右上角的“ x”符号)

Close button does not close the alert

这是此警报的特定代码。我正在使用Laravel 5.8.15版和最新的引导程序,如果有帮助

<div class="mg-auto justify-content-center">
        @if ($errors->any())
            <div class="alert alert-warning alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="alert-heading">Oops! Something went wrong!</h4>
                <p>
                    @foreach ($errors->all() as $error)
                        - {{ $error }}<br>
                    @endforeach
                </p>
            </div>
        @endif
    </div>

我的脚本文件对齐:

<script src="{{ asset('js.jquery-341.js') }}"></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>

1 个答案:

答案 0 :(得分:1)

您确定已正确集成bootstrap's javascript plugin吗?像这样调用jQuery之后,必须调用它:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js" ></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js" ></script>

<div class="mg-auto justify-content-center">
        @if ($errors->any())
            <div class="alert alert-warning alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="alert-heading">Oops! Something went wrong!</h4>
                <p>
                    @foreach ($errors->all() as $error)
                        - {{ $error }}<br>
                    @endforeach
                </p>
            </div>
        @endif
    </div>