Mike
Mike

Reputation: 1139

Bootstrap dropdown menu doen't work

I am trying to use a simple bootstrap dropdown menu but the menu doesn't dropdown when clicking on it. (I am working with java spring mvc 4)

<script src="jq/jquery-2.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link id="active_style" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/cosmo/bootstrap.min.css">

<script>
$(document).ready( function() {
$('.dropdown-toggle').dropdown();
});
</script>

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<title>TEST</title>
</head>


<body>
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
<li role="presentation" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
  Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
    <li role="presentation"><a href="#">Profile</a></li>
    <li role="presentation"><a href="#">Messages</a></li>
</ul>
</li>
</ul>
</body>
</html>

It works fine when testing it: enter link description here.

I have tried many suggestions but nothing solve the problem.

Thanks, Mike

Upvotes: 0

Views: 1056

Answers (1)

Mike
Mike

Reputation: 1139

seems that bootstrap and jQuery wasn't on my machine. Adding the following solve the problem:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link id="active_style" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/cosmo/bootstrap.min.css">

Thanks!

Upvotes: 1

Related Questions