Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: FileUpload initialization not working

davesmacer priority asked 1 year ago


I can't seem to use:

var fileUploadInst = new FileUpload(photoInputElem);

I'm getting next error:

> Uncaught TypeError: (0 , t.initMDB) is not a function
>     at i.value (file-upload.js:81:13)
>     at new i (file-upload.js:71:10)

davesmacer priority commented 1 year ago

I have to use JS initialization because I add html dynamically to my site, it's not there on first refresh, so the tag data-mdb-file-upload-init is not working


davesmacer priority commented 1 year ago

Treeview plugin is not working either, is giving similar error


Kamila Pieńkowska staff answered 11 months ago


Auto inits are performed on the page load. If you add anything later you need to initialize it yourself with JS. That's just how the package works.

Here is how you should initialize File Input with JS: https://mdbootstrap.com/snippets/standard/kpienkowska/5876668#js-tab-view



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: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 7.1.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No