Date Picker doesn't appear from Ajax call


Topic: Date Picker doesn't appear from Ajax call

yorkmyers pro premium priority asked a year ago

I'm making an Ajax call that returns HTML, which is trying to display a Date Picker.

While the Date Picker works upon initial page load (without an Ajax call)... it appears a a regular input box from the Ajax call.

Can you please share how I can re-initialize Date Pickers from dynamically loaded items?

I'm guessing it would be similar to this question previously posted that involved tooltips needing to be re-initialized upon datatable.

Thank you.


kpienkowska staff answered a year ago

You need to init your datepicker after it is added with JS:

const myDatepicker = new mdb.Datepicker(document.getElementById('myDatepicker'))

yorkmyers pro premium priority commented a year ago

This works; thank you!


yorkmyers pro premium priority answered a year ago

while it does work, I do get an error in the console: enter image description here enter image description here


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
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.11.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes
Tags