MDB5 DatePicker - listener events not working

Topic: MDB5 DatePicker - listener events not working

smachesney asked a year ago


I'm trying to use javascript to detect value change. I have tried the provided event listener:

const myDatepicker = document.getElementById('jobStartDateField') myDatepicker.addEventListener('dateChange.mdb.datepicker', (e) => { // do something... updateJobSetUpFields(this); })

But it is not firing, none of the events are firing. I've also tried onchange on the input element and this also doesn't work.

Thank you

tommyw pro premium priority answered a year ago

you should be listening to the parent id, ie the div surrounding the datepicker instead!

Dawid Wajszczuk staff answered a year ago

It is exactly as tommyw said. You should be listening to the parent id. Here I have created a snippet for you.
Keep coding,

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
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: desktop
  • Browser: Chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No