I’m currently facing some challenges with getting the Twitter Bootstrap drop-down navbar feature to function properly. Despite going through various tutorials, I am unable to make it work by directly copying the code. The console displays the following error:
TypeError: $ is undefined
var old = $.fn.dropdown
Below is my code snippet:
<div class="container-fluid">
<div class="row-fluid">
<div class="span8">
<!--Body content-->
<div class="navbar">
<div class="navbar-inner">
<ul id="tab" class="nav">
<li class="active"><a href="#Tab1" data-toggle="tab">Recent</a></li>
<li><a href="#Tab2" data-toggle="tab">Top</a></li>
<li><a href="#Tab3" data-toggle="tab">Near you</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Filters <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Filter1</a></li>
<li><a href="#">Filter2</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="span4">
<!--Sidebar content-->
</div>
</div>
</div>
Here are the included files, which load successfully:
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="bootstrap/js/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
Although the page loads, clicking on the Filters menu item triggers the mentioned exception and doesn’t perform any action.