Topic: mdb-select duplicate after option manipulation
Jorge Nuñez Malledo asked 5 years ago
Actual behavior mdb-select duplicates itself after sucesives jquery option adding operations. Am I doing something wrong?
Resources (screenshots, code snippets etc.) Check the following snippet. The first button adds five options, and the second five more. This second button triggers the bad behavior. In my browser this happens with every option manipulation (for example, setting the disabled prop), but I couldn't reproduce it in the snippet
https://mdbootstrap.com/snippets/jquery/jorge_nunez_malledo/1833318
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.14.0
- Device: Lenovo T480
- Browser: Mozilla Firefox 73.0.1 (64-bit)
- OS: Windows 10
- Provided sample code: No
- Provided link: Yes
Grzegorz Bujański staff commented 5 years ago
Hi. Destroy and init select after append options list is unnecessary. After i comment this in your snippet append options working well.
Best, Grzegorz
Jorge Nuñez Malledo commented 5 years ago
Thank you for your answer Grzegoz. So, under which circumstances the reset (destroy/init) is necessary?
Grzegorz Bujański staff commented 5 years ago
For example in situations where you give the user the option to remove a field from the form, but you also want to give the option to undo this change