MDB5 DatePicker - listener events not working


Topic: MDB5 DatePicker - listener events not working

smachesney asked a year ago

Hi

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

Hi,
It is exactly as tommyw said. You should be listening to the parent id. Here I have created a snippet for you. https://mdbootstrap.com/snippets/standard/d-wajszczuk/2981034#html-tab-view
Keep coding,
Dawid


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: 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
Tags