FileUpload initialization not working


Topic: FileUpload initialization not working

davesmacer pro premium priority asked 9 months 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 pro premium priority commented 9 months 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 pro premium priority commented 9 months ago

Treeview plugin is not working either, is giving similar error


Kamila Pieńkowska staff answered 9 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
  • User: Pro
  • 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