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?
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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- 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