jquerytwitter-bootstrapjsfiddle

Bootstrap navbar dropdown not opening


Bootstrap nav collapsing as expected but not displaying drop down when hamburger is clicked. JSFiddle example here - using: bootstrap/3.3.7/css/bootstrap.min.css and bootstrap/3.3.7/js/bootstrap.min.js as my two external resources.

I have found others stating that the data-target of the button needs to match the ID of the div that contains the collapsed navigation. In my case, data-target="#page-nav-tabs" and my div id="page-nav-tabs". But this still does not work....please help!

UPDATE: found the fix for the collapsed menu not opening - needed to include jquery scripts. Now, I still have the problem that the "Create New" drop down is not working.

<section id="right-pane-wrapper">
  <section id="secondary-nav" class="row">

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#page-nav-tabs" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="collapse navbar-collapse" id="page-nav-tabs">
      <ul class="nav navbar-nav">
        <li><a href="#">Summary</a></li>
        <li class="active"><a href="#">Claim Tree</a></li>
        <li><a href="#">Assignment</a></li>
        <li><a href="#">Reserve Summary</a></li>
        <li><a href="#">Related Claims</a></li>
        <li><a href="#">Indicators</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
          <button type="button" class="btn btn-default dropdown-toggle">Create New <span class="caret"></span></button>
            <ul class="dropdown-menu">
              <li><span><a id="addNotification" href="#"><span>Reminder</span></a></span></li>
              <li><span><a id="addMessage" href="#"><span>Message</span></a></span></li>
              <li><span><a href="#"><span>Letter</span></a></span></li>
            </ul>
        </li>
        </ul>
    </div>
  </div>
</nav>

  </section>
</section>

Solution

  • <!DOCTYPE html>
    <html lang="en">
    <head>
      <title>Bootstrap Example</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
      <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    </head>
    <body>
    <section id="right-pane-wrapper">
      <section id="secondary-nav" class="row">
    
    <nav class="navbar navbar-default">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#page-nav-tabs" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        </div>
    
        <div class="collapse navbar-collapse" id="page-nav-tabs">
          <ul class="nav navbar-nav">
            <li><a href="#">Summary</a></li>
            <li class="active"><a href="#">Claim Tree</a></li>
            <li><a href="#">Assignment</a></li>
            <li><a href="#">Reserve Summary</a></li>
            <li><a href="#">Related Claims</a></li>
            <li><a href="#">Indicators</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
    
            <li class="dropdown">
              <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">Create New <span class="caret"></span></a>
                <ul class="dropdown-menu">
                  <li><span><a id="addNotification" href="#"><span>Reminder</span></a></span></li>
                  <li><span><a id="addMessage" href="#"><span>Message</span></a></span></li>
                  <li><span><a href="#"><span>Letter</span></a></span></li>
                </ul>
            </li>
            </ul>
        </div>
      </div>
    </nav>
    
      </section>
    </section>
    </body>
    </html>
    

    Check this one its working now

    OR simply replace button line with

    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Create New <span class="caret"></span></button>