Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


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

ktakiya priority asked 3 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 3 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.

https://mdbootstrap.com/snippets/standard/m-duszak/3545967#html-tab-view


ktakiya priority commented 3 years ago

Thank you Michal!



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

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