简体   繁体   English

Bootstrap下拉菜单无法正常工作

[英]Bootstrap dropdown not working properly

Please find the jsFiddle below. 请在下面找到jsFiddle。 I am trying to implement a simple Bootstrap dropdown button, but I am not able to achieve it. 我正在尝试实现一个简单的Bootstrap下拉按钮,但无法实现。

Can someone please let me know what am i missing. 有人可以让我知道我在想什么。

html HTML

<div class="dropdown">
  <button class="btn dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
    Dropdown
    <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
    <li role="presentation" class="divider"></li>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
  </ul>
</div>

JS JS

$('.dropdown-toggle').dropdown();
$('#dropdownMenu1').dropdown('toggle');

Please find the fiddle link below: 请在下面找到小提琴链接:

http://jsfiddle.net/rohan2911/BVZ6G/ http://jsfiddle.net/rohan2911/BVZ6G/

Your fiddle needed jQuery: 你的小提琴需要jQuery:

http://jsfiddle.net/isherwood/BVZ6G/1 http://jsfiddle.net/isherwood/BVZ6G/1

Uncaught Error: Bootstrap requires jQuery bootstrap.min.js:6
Uncaught ReferenceError: $ is not defined 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM