Topic: MDB5 DatePicker - listener events not working

smachesney free asked 3 years 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


Dawid Wajszczuk staff answered 3 years 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


tommyw priority answered 3 years ago


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



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

  • 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: No