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: Dynamically added select initialisation

slavaveto free asked 2 years 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 2 years ago


thanks! it works just fine


Dawid Wajszczuk staff answered 2 years 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

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