mdb-select duplicate after option manipulation


Topic: mdb-select duplicate after option manipulation

Jorge Nuñez Malledo pro premium asked a year 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


Grzegorz Bujański staff commented a year 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 pro premium commented a year ago

Thank you for your answer Grzegoz. So, under which circumstances the reset (destroy/init) is necessary?


Grzegorz Bujański staff commented a year 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


Please insert min. 20 characters.
Status

Open

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: 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