Topic: Dynamically added select initialisation

slavaveto free asked 9 months ago


I am building a modal dynamically with a select in the modal body. But the styling on the selectisnt applied

how to solve it?


slavaveto free answered 9 months ago


thanks! it works just fine


Dawid Wajszczuk staff answered 9 months ago


Hi,

Try this code:

document.querySelectorAll('.select').forEach((select) => {
        const instance = mdb.Select.getInstance(select)
        if (!instance) {
            new mdb.Select(select)
        }
});

Keep coding,
Dawid



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: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: MacBook
  • Browser: Chrome
  • OS: MacOs
  • Provided sample code: No
  • Provided link: No