Problems with onclick event in comboBox (Select)


Topic: Problems with onclick event in comboBox (Select)

eckies pro premium priority asked 11 months ago

Hello, I am initializing a combo via js (new mdb.Select(this.$myWidget);) and I need to control the onclick event. I have tried the following way: this.$myWidget.on('click', function (event) {...

and the event does not fire. How can I control the onclick event of the select component?.


Kamila Pieńkowska staff answered 11 months ago

You can use the events we provide. For example open.mdb.select that is triggered after click but before select is open.

const mySelect = document.getElementById('mySelect')
mySelect.addEventListener('open.mdb.select', (e) => {
  // do something...
})

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.1
  • Device: All
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: No