Topic: materialSelect launched without call
wealthtechs pro premium priority asked 5 years ago
After destroying material select, when I update the options elements on DOM whit .append, .prepend or .html the "materialSelect()" method is called automatically. How to prevent this behavior? Why the select is initialized again without any call?
Snippet: https://mdbootstrap.com/snippets/jquery/wealthtechs/2097941
Also, and more critical, each insert duplicates the wrapper on select, so we can't modify our options because this generates a chain of dups (inspect the wrapper after 3 clicks on the button)
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- Premium support: Yes
- Technology: MDB jQuery
- MDB Version: 4.18.0
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes
Grzegorz Bujański staff commented 5 years ago
Hi. I can't open your snippet. Did you click publish?
wealthtechs pro premium priority commented 5 years ago
I saved as draft, sorry please try again
Grzegorz Bujański staff commented 5 years ago
Ok, I got it. Actually, something is wrong. We will check and fix it.
vrivero pro premium commented 5 years ago
In the meantime you can add
data-stop-refresh="true"
to stop the observer from re-initializing the material select