Topic: Date Picker doesn't appear from Ajax call

yorkmyers priority asked 1 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.


Kamila Pieńkowska staff answered 1 year ago


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

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

yorkmyers priority commented 1 year ago

This works; thank you!


yorkmyers priority answered 1 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

  • ForumUser: Priority
  • 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