Topic: Individual Modules not working with javascript mdb
Hi
Firstly thanks for a great product! I only need to use a few of your components and due to speed and optimisation i am trying to load only module i need, in this case Modal and select.
When I load individual modal.min.js and select.min.js modules my function throws an "mdb not defined" error when I call mdb. Please advise how the I can manipulate select and modal with JS without importing mdb.min.js. When I use mdb.min.js instead of the individual components the script works.
using the following modules /js/modules/modal.min.js /js/modules/select.min.js
function CallMeBackModal(OptionValue) { event.preventDefault(); //Set select value based on button pressed const selectEl = document.getElementById('modal-cta-type'); const select = (mdb.Select.getInstance(selectEl)).setValue(OptionValue);
const myModalEl = document.getElementById('callmebackModal');
const modal = new mdb.Modal(myModalEl);
modal.show();
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.10.0
- Device: AMD
- Browser: All
- OS: Win10
- Provided sample code: No
- Provided link: No
Dawid Wajszczuk staff commented 3 years ago
Try calling Modal and Select without
mdb.
prefix.darekjan pro premium commented 3 years ago
Works thanks! It has to be aall small letters thou, case sensitivity....