Laravel-Bootstrap的JavaScript需要jQuery错误 [英] Laravel - Bootstrap's JavaScript requires jQuery error
问题描述
在我的laravel项目中从引导CSS添加导航栏时,下拉菜单出现问题...菜单未级联.从浏览器检查html元素时发现以下错误...
While adding navbar from bootstrap css in my laravel project, am having an issue with the Dropdown Menu...the Menu is not getting cascaded. While checking html element from the browser have found the following error...
Bootstrap的JavaScript需要jQuery错误
Bootstrap's JavaScript requires jQuery error
以下是CDN,我已经在主文件中使用过...
And following is the CDNs, I have used in my master file...
<head>
<meta charset="uth-8">
<title>@yield('title')</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
</head>
<body>
@include('layouts.partials.header')
@yield('content')
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
有人可以帮我解决这个问题吗?尽管已经用它搜索了一下,发现应该在bootstrap3.3.7版本中解决这个问题,但是没有运气...
Can anyone please help me with this issue...though have googled it and found this issue should be taken care in bootstrap3.3.7 edition am with no luck...
推荐答案
在加载Bootstrap JS之前必须先加载jQuery ...而不是两次加载Bootstrap JS!
You have to load jQuery before you load Bootstrap JS ... not Bootstrap JS twice!
<head>
<meta charset="utf-8">
<title>@yield('title')</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
</head>
<body>
@include('layouts.partials.header')
@yield('content')
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
它是 utf-8
而不是 uth-8
这篇关于Laravel-Bootstrap的JavaScript需要jQuery错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!