2

Below is my snippet for using Bootstrap which contains a single drop-down button. Any idea why it is not working? (when I click it just doesn't open anything).

I saw similar posts here and here. But none of the suggested solutions solutions solved my problem.

<html> 
    <head> 
        <title>Bootstrap 3 </title>
        <link href ="css/bootstrap.css" rel = "stylesheet">
        <link href ="css/bootstrap.min.css" rel = "stylesheet">
        <link href ="css/bootstrap-theme.min.css" rel = "stylesheet">
        <link href ="css/styles.css" rel = "stylesheet">

        <script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </head> 
    <body> 


        <!-- Single button -->
        <div class="btn-group">
          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
            Action <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </div>


    </body> 
</html> 
Community
  • 1
  • 1
Daniel
  • 5,839
  • 9
  • 46
  • 85
  • 1
    Are you testing it locally and maybe jquery isn't loaded? I just created this bootply http://www.bootply.com/q6r1f5tZJU with your markup and it's working. – matthias_h Jan 17 '15 at 00:37
  • But this part: "//code.jquery.com/jquery-1.11.2.min.js" doesn't it mean that it will load the jquery from web? – Daniel Jan 17 '15 at 00:49
  • 1
    Not necessarily, it just means that it will use the protocol from the page - if the page protocol is `http`, it will be loaded from `http://` (and same with `https`) - you should check web dev net console if jquery is loaded or, what is possible, if the page tries to load e.g. from `file://` instead of `http://` in case you're running it locally. For local testing, add `http://` or download jquery and load it local like you're already doing with bootstrap. – matthias_h Jan 17 '15 at 00:54

1 Answers1

3

Cannot recognize jquery.js file. Please change this

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

to

<script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
Lumi Lu
  • 3,289
  • 1
  • 11
  • 21
  • Why ??? This is so wrong and its even against the official instruction http://jquery.com/download/#using-jquery-with-a-cdn – Edo Jul 08 '15 at 09:47