FrancescoMussi
FrancescoMussi

Reputation: 21630

Bootstrap3: Dropdown menu

I am making a site using Bootstrap 3.0.0 All is fine except that the dropdown menu is not working. In the head of the file i am making this declarations:

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.css" rel="stylesheet">

<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet" />

<link href="http://fonts.googleapis.com/css?family=Abel|Open+Sans:400,600" rel="stylesheet" />

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/dropdown.js"></script>

Something is missing there?

The html should be correct:

<li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown-example<span class="caret"></span></a>
        <ul class="dropdown-menu">
          <li><a href="#link-1">link 1</a></li>
          <li><a href="#link-2">link 2</a></li>
          <li><a href="#link-3">link 3</a></li>
          <li><a href="#link-4">link 3</a></li>
        </ul>
      </li>

Does anyone knows how to do?

Upvotes: 2

Views: 732

Answers (3)

fixxxer
fixxxer

Reputation: 16164

Just close the tag where you link to bootstrap.css. The "/" before the last angle bracket is missing in the code in your question. <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.css" rel="stylesheet" />

Upvotes: 0

jporcenaluk
jporcenaluk

Reputation: 966

Link to your external javascript file jquery.js before Bootstrap.js.

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/dropdown.js"></script>

You need to load jQuery before you use it.

Upvotes: 2

jarasss
jarasss

Reputation: 528

I'm not sure but this scripts should be probably included at the end of html document

<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/dropdown.js"></script>

Did you include jQuery too? Bootstrap plugins depend on this.

Upvotes: 1

Related Questions