Topic: Multi Select Setting Values

jamie priority asked 2 years ago

I am trying to dynamcially set the values of a multi select dropdown. using the example where we set the values directly is seems to work but if i put them into a variable first then they dont.

Dawid Wajszczuk staff answered 2 years ago


It works fine for me. Here is the snippet The variable just needs to be an object. There were unnecessary quotation marks.

Keep coding,

jamie priority answered 2 years ago

thanks, i was trying to create a string from my data rather than creating an array

    const values = [];
        options = Array.from(document.querySelectorAll('#categories option'));
        for (var i = 0; i < cat.length; i++) {
            const multiSelect = document.querySelector('#categories');
            const multiSelectInstance = mdb.Select.getInstance(multiSelect);

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: pc
  • Browser: chrome
  • OS: 11
  • Provided sample code: No
  • Provided link: No