Topic: AddEventListener for dropdown not working

joannarom free asked 3 years ago

Expected behavior console message is logged for the following code

const myDropdown = document.getElementById('myDropdown')
myDropdown.addEventListener('show.mdb.dropdown', () => {
    console.log("event fired");

Actual behavior nothing happens

Resources (screenshots, code snippets etc.) using the referenced code on

const myDropdown = document.getElementById('myDropdown')
myDropdown.addEventListener('show.mdb.dropdown', () => {
    // do something...

I am adding this to my page and nothing is happening, not even an error

In addition, the "Open in MDB Editor" has console errors and doesn't work.

Grzegorz Bujański staff answered 3 years ago

Here is a working example:

joannarom free commented 3 years ago

Hi Grzegorz,

The example provided, does not have any console errors, but it also does not fire off any console logging when clicking on the drop down. So, unfortunately it does not solve my problem.

Grzegorz Bujański staff commented 3 years ago

Can you check again? I see that after opening the dropdown, console.log ("event fired") is called and I can see this text in the browser console. maybe you didn't notice him? I also added an alert.

joannarom free commented 3 years ago


Yes you are correct. I currently am having a really strange browser issue. A lot of the mdb5 components do not work properly on one computer (desktop), but on the other computer they work fine (laptop). Browser versions are all the same.

Unrelated to the above issue, have you seen this happen before?

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: desktop
  • Browser: Chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: Yes