Topic: Question on Multiple-Select or Select, How to reset selected options?
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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- 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