Skip to content Skip to sidebar Skip to footer

Why Doesn't This Bootstrap Dropdown Example Work?

I'm just trying out the example in Bootstrap documentation, but it doesn't seem to work. I just get plain HTML. This is my code:

Solution 1:

I see two problems with your markup.

First, you're including the bootstrap plugin "before" the jquery plugin. Jquery first, bootstrap plugins second.

Second, you're using a DOCTYPE that is not supported by the bootstrap, you have to use HTML5's DOCTYPE:

<!DOCTYPE html>

Solution 2:

I think jquery.js should be imported before the bootstrap javascript file

Solution 3:

I dont see your <body> opening tag

Solution 4:

Working demohttp://jsfiddle.net/jyy96/2/orhttp://jsfiddle.net/jyy96/2/show or http://jsfiddle.net/jyy96/

EDIT 9th July 2015 -Fixed here: http://jsfiddle.net/jyy96/792/ or http://jsfiddle.net/jyy96/792/show/

==========================================

Looks like bootstrapcdn is the popular choice, but for those wanting to use cdnjs.com, they have "all the files" and keep them up to date (version 2.0.0 through 2.1.1).

http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.css
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap-responsive.css
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap-responsive.min.css
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/bootstrap.js
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/bootstrap.min.js
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/img/glyphicons-halflings-white.png
http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/img/glyphicons-halflings.png

==========================================

Hope this help.

script

  <script type="text/javascript" src="/js/lib/bootstrap-2.0.2.js"></script>


  <linktype="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">

Jquery code

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

[1] https://github.com/twbs/bootstrap/issues/1679

Post a Comment for "Why Doesn't This Bootstrap Dropdown Example Work?"