turbolinks was the problem. When I removed it from application.js (as well as the gem), dropdown started working fine
Dropdown menu not appearing - Rails4+boostrap
-
20-07-2023 - |
سؤال
In my _header.html.erb, I have the following:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle='dropdown'>
Journal Entries
<b class='caret'></b>
</a>
<ul class="dropdown-menu">
<li><%= link_to "List all Journal Entries", sournal_entries_path %></li>
<li><%= link_to "New Journal Entry", new_journal_entry_path %></li>
</ul>
</li>
In my application.js, I have the following:
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/collapse
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover
//= require google-code-prettify
//= require turbolinks
//= require_tree .
The menu item (Journal Entries) appears, with a carret next to it, but clicking on the carret or the menu item does nothing. What am I missing?
المحلول
لا تنتمي إلى StackOverflow