bootstrap-rubygem icon indicating copy to clipboard operation
bootstrap-rubygem copied to clipboard

Dropdown menu isn't opening

Open alexsouzabh opened this issue 6 years ago • 4 comments

Hi, I tried to use this GEM in distinct SO (Windows and Linux), tried to look at google but I'm not able to resolve. I create a dropdown menu, it's showed in Browser but I'm not able to open. I'm running rails: 6.0.0 ruby: 2.6.5p114 Ubuntu 16.04.6 LTS

An example that I'm using

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown button
  </button>
  <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
    <a class="dropdown-item" href="#">Action</a>
    <a class="dropdown-item" href="#">Another action</a>
    <a class="dropdown-item" href="#">Something else here</a>
  </div>
</div>

Thank you!

alexsouzabh avatar Oct 27 '19 02:10 alexsouzabh

Probably using the wrong bootstrap version / html code. Copy paste the bootstrap example of dropdown for the version of your gem and it should work. Then check the differences with your code (I had to change the html structure when moving from bootstrap 3 to 4)

estani avatar Apr 16 '20 13:04 estani

I was running into this with the following error in the console:

bootstrap.js:1498 Uncaught TypeError: Cannot convert object to primitive value
    at RegExp.test (<anonymous>)
    at HTMLDivElement.<anonymous> (bootstrap.js:1498)
    at Function.each (jquery.js:325)
    at jQuery.fn.init.each (jquery.js:165)
    at jQuery.fn.init._jQueryInterface [as collapse] (bootstrap.js:1492)
    at HTMLDivElement.<anonymous> (bootstrap.js:1552)
    at Function.each (jquery.js:325)
    at jQuery.fn.init.each (jquery.js:165)
    at HTMLButtonElement.<anonymous> (bootstrap.js:1547)
    at HTMLDocument.dispatch (jquery.js:4670)

Downgrading to jQuery 3.4.1 worked for me. More information can be found here.

bswinnerton avatar Apr 16 '20 13:04 bswinnerton

Dropdown also isnt working here, but your solution didnt work for me. @alexsouzabh have you had any luck?

mystycs avatar May 04 '20 20:05 mystycs

for those looking for solution to this, I found a work around for this problem. Follow the steps from here and the dropdown will work using the code template for bootstrap 4.

Hope this helps!

aj-leal avatar Sep 03 '20 15:09 aj-leal