Bootstrap 2.3.2 dropdown menu

Jeroen Custers picture Jeroen Custers · Sep 18, 2013 · Viewed 8.1k times · Source

I don't understand why this simple example is not working. I can't find the error. I am using bootstrap 2.3.2 and jquery 1.9.1 source files. Thanks in advance for your help. See the code below. The dropdown part is from the bootstrap site (http://getbootstrap.com/2.3.2/components.html#dropdowns).

<!DOCTYPE html>
<html lang="en">
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
  <link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css" />
  <script src="js/jquery.js" type="text/javascript"></script>
  <script src="js/bootstrap.js" type="text/javascript"></script>
</head>

<body>
  <div class="container">
    <div class"row">
      <div class="span12">
        <div class="dropdown">
          <!-- Link or button to toggle dropdown -->
          <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
            <li><a tabindex="-1" href="#">Action</a></li>
            <li><a tabindex="-1" href="#">Another action</a></li>
            <li><a tabindex="-1" href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a tabindex="-1" href="#">Separated link</a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</body>
</html>

Answer

Dmitry Efimenko picture Dmitry Efimenko · Sep 18, 2013

You do not have a button that will trigger drop down to appear. Replace <!-- Link or button to toggle dropdown --> with the following:

<button class="btn dropdown-toggle" data-toggle="dropdown">
      Action
      <span class="caret"></span>
</button>