Topic: materialSelect launched without call
wealthtechs
pro asked 11 months 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)
Open
- User: Pro
- Premium support: No
- Technology: 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 10 months ago
Hi. I can't open your snippet. Did you click publish?
wealthtechs pro commented 10 months ago
I saved as draft, sorry please try again
Grzegorz Bujański staff commented 10 months ago
Ok, I got it. Actually, something is wrong. We will check and fix it.
vrivero pro premium commented 10 months ago
In the meantime you can add
data-stop-refresh="true"to stop the observer from re-initializing the material select