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: Individual Modules not working with javascript mdb

darekjan premium asked 3 years ago


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();

}


Dawid Wajszczuk staff commented 3 years ago

Try calling Modal and Select without mdb. prefix.


darekjan premium commented 3 years ago

Works thanks! It has to be aall small letters thou, case sensitivity....



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

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