未捕获的错误:Bootstrap的JavaScript需要jQuery。必须在Bootstrap的JavaScript之前包含jQuery。在bootstrap.min.js:6

时间:2017-10-06 06:40:26

标签: php jquery bootstrap-4

我尝试将bootstrap和jquery文件包含到我的项目中,但是当我这样做时。它给了我错误。 "未捕获的错误:Bootstrap的JavaScript需要jQuery。必须在Bootstrap的JavaScript之前包含jQuery。在bootstrap.min.js:6"这是我的代码:

$ git commit -m "adding empty folder"

我已经将文件下载到我的项目中,但它让我收到错误

1 个答案:

答案 0 :(得分:1)

按如下方式添加外部文件

您可以在headerfooter中添加js文件但保持此顺序

首先加载Jquery,然后添加bootstrap js

Reference

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<script src="js/popper.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/w3.css">



<body>
<div class="topd">
<h1>Welcome to HopesV2.0</h1>
</div>
<nav class="navbar navbar-expand-lg navbar-light w3-teal" data-spy="affix" data-offset-top="197">
  <a class="navbar-brand" href="#"></a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    <div class="navbar-nav">
    <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        HR
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
      <a class="nav-item nav-link" href="#">Features</a>
      <a class="nav-item nav-link" href="#">Pricing</a>
      <a class="nav-item nav-link disabled" href="#">Disabled</a>
    </div>
  </div>
</nav>
<BR>
<!-- Start Body -->
<div class="jumbotron zbody">
  <h1>Basic Information</h1>
  <hr class="my-4">
<p class="lead">

    <a class="btn btn-primary " href="#" role="button">Submit</a>
  </p>
</div>

</body>