Topic: Question on Multiple-Select or Select, How to reset selected options?

ktakiya priority asked 2 years ago

Expected behavior when user clicked reset button to reset form, and then select control should be unselected value with initial states.

How do I use javascript API to empty my selected value?

Actual behavior

Resources (screenshots, code snippets etc.)

Called JS API mdb.Select.getInstance(select).setValue('');

Michał Duszak staff answered 2 years ago

You're right. Use the setValue('') method to achieve resetting value behaviour. If you do it on Multiple-Select, the Select itself stays empty, but if it comes to basic Select, it cannot stay empty, so it clears to the value of the first option provided.

ktakiya priority commented 2 years ago

Thank you Michal!

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Mac
  • Browser: FF
  • OS: MacOS
  • Provided sample code: No
  • Provided link: No