Topic: Dynamically added select initialisation
                  
                  slavaveto
                  free
                  asked 3 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?
                      
                        Add comment
                      
                    
                  
                
                      
                      Dawid Wajszczuk
                      staff
                        answered 3 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.
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