I am using Twitter Bootstrap in my web app and have included bootstrap.css/js
files. But when I click on menu base
it doesn’t unfold and nothing happens.
Any idea what is wrong? Here is my code:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">menu base</a>
<ul class="dropdown-menu" aria-labelledby="more-drop">
<li class="dropdown-menuitem">
<a href="/page1">sub menu1</a>
</li>
<li class="dropdown-menuitem">
<a href="/page2">sub menu2</a>
</li>
</ul>
</li>
3
Answers
Here is the Working Code:
Working Fiddle: Dropdown Menu Fix
Mistake:
1- Dropdown Menu ‘aria-labelledby’ is not defined
2- Anchor Tag ID is not set with ‘aria-labelledby’ value
aria-labelledby: Identifies the element (or elements) that labels the current element.
You have missed the following attributes necessary for Bootstrap dropdown to work as toggle dropdown menu.
Code Snippet
Hope this may helps you