Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap Button Dropdown not dropping down

I am trying to use a simple dropdown button from the Twitter Bootstrap. However, it's isn't showing the dropdown options. The code is below and here is a link to a fiddle: http://jsfiddle.net/nunos/DjHyQ/11/

EDIT: found out the problem. I was including the bootstrap.js in the <head>. Once I changed that line to the <body> as the Twiiter Bootstrap Documentation actually says, it worked right away. I never thought there was a difference in scripts being included in the <head> or in the <body>. Now I know!

<div class="btn-toolbar" style="margin: 0;">
    <div class="btn-group">
        <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
        <ul class="dropdown-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>
</div>
​
like image 611
nunos Avatar asked Nov 25 '22 10:11

nunos


1 Answers

Well, the fiddle you posted isn't working because you have not selected jquery (which is required for bootstrap widgets) as your framework (the selection box is on the sidebar on the right hand side of the page). Are you loading jquery in your actual code?

like image 91
RoryB Avatar answered Nov 26 '22 23:11

RoryB