jquery - Bootstrap 警报未关闭

标签 jquery twitter-bootstrap

我在关闭 Bootstrap 警报时遇到问题。我在 Bootstrap 之前声明了 jquery,但警报仍然没有关闭。警报的代码如下。有任何想法吗?

  <!-- jquery -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

  <!-- bootstrap -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">


  <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>
     <strong>Yay</strong> Your email has been added!
  </div>

最佳答案

您仍然需要添加 Twitter Bootstrap 核心 JS。

<!-- jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

<!-- bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">


<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>
  <strong>Yay</strong> Your email has been added!
</div>

关于jquery - Bootstrap 警报未关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31577475/

相关文章:

jquery - jsTree 排序功能慢得离谱

javascript - 将 onclick 添加到页面上除具有特定类的 anchor 之外的所有 anchor

jquery .remove() 未按预期工作

css - 你如何使用 Bootstrap 将表单控件居中?

css - Safari 7.1 CSS 同级选择器问题

javascript - jquery 代码未在 Android 手机上运行

javascript - 使用 jQuery 动态添加/删除输入字段

javascript - 来自 html title 属性的 jquery 工具提示

html - 在 Bootstrap 4 Alpha 6 中对齐表单?

html - DIV 行和 HR 扩展到容器之外(Bootstrap)