Topic: FileUpload initialization not working
davesmacer pro premium priority asked 11 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)
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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- 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
davesmacer pro premium priority commented 11 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 11 months ago
Treeview plugin is not working either, is giving similar error