Topic: MDB5 Datepicker event not working

smachesney free asked 3 years ago


Hi

Using a snippet I reproduced my issue:

<div class="form-outline datepicker"> <input type="text" class="form-control" id="exampleDatepicker1" /> <label for="exampleDatepicker1" class="form-label">Select a date</label> </div>

const myDatepicker = document.getElementById('exampleDatepicker1') myDatepicker.addEventListener('open.mdb.datepicker', (e) => { // do something... alert('hello'); })

It doesn't work. The event listener doesn't fire.

Can you please provide me with a solution or workaround to listen out for event changes. The standard onchange event doesn't work

Thanks Sonia


Michał Duszak staff answered 3 years ago


Hello,

You have to listen on the div here. I prepared a snippet for you:

https://mdbootstrap.com/snippets/standard/m-duszak/2959280#js-tab-view

Best regards,

Michal


smachesney free commented 3 years ago

Thank you so much Michal!



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

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