Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap dropdown not working

I can't make bootstrap dropdown to work. Here is my html for nav:

<ul class='nav'>   <li class='active'>Home</li>   <li class='dropdown'>     <a class="dropdown-toggle" data-toggle="dropdown" href='#'>Personal asset loans</a>     <ul class="dropdown-menu" role="menu">       <li><a href="#">asds</a></li>       <li class="divider"></li>     </ul>   </li>   <li>Payday loans</li>   <li>About</li>   <li>Contact</li> </ul> 

And here are the scripts:

<script type="text/javascript" src="js/bootstrap/bootstrap-dropdown.js"></script> <script>      $(document).ready(function(){         $('.dropdown-toggle').dropdown()     }); </script> 

What am I doing wrong? Thanks for your answers!

like image 839
hjuster Avatar asked Sep 17 '12 11:09

hjuster


People also ask

Why dropdown link is not working in Bootstrap?

Solution : The dropdown should be toggled via data attributes or using javascript. In the above program, we have forgotten to add a data attribute so the dropdown is not working. So add data-bs-toggle="dropdown" to toggle the dropdown.

Why dropdown menu is not working?

Solution. The reason of this behaviour is the default setting for the mouse in Windows 10. By default the setting Scroll inactive windows when I hover over them in the Windows settings is turned on. If you switch this setting off, you can scroll again through large dropdown-menus.

How do I select a dropdown in Bootstrap?

To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute. The . caret class creates a caret arrow icon (), which indicates that the button is a dropdown.

How do you open Bootstrap dropdown menu on hover rather than click?

Answer: Use the jQuery hover() method By default, to open or display the dropdown menu in Bootstrap you have to click on the trigger element. However, if you want to show the dropdown on mouseover instead of click you can do it with little customization using the CSS and jQuery.


1 Answers

I had the same problem. After a couple of hours of trouble shooting found that,

I had

<script type="text/javascript" src="Scripts/bootstrap.min.js"></script> <script type="text/javascript" src="Scripts/jquery-2.1.1.min.js"></script> 

instead of,

<script type="text/javascript" src="Scripts/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="Scripts/bootstrap.min.js"></script> 

Hope this helps someone

like image 177
Prince Ashitaka Avatar answered Sep 21 '22 14:09

Prince Ashitaka