Topic: How to have multiple select set value to null or empty array?

Jordan Mack pro asked 1 year ago


Expected behavior Setting multiple select to: null or [] to unselect all values

Actual behavior first options is always selected

Resources (screenshots, code snippets etc.)

I've created a snippet here:

https://mdbootstrap.com/snippets/standard/jps_mack/4691351#js-tab-view


Kamila Pieńkowska staff answered 1 year ago


The set value method works well. Problem is with you setting multiple via JS option. Pass it as attribute and it will work well. Your snippet adjusted: https://mdbootstrap.com/snippets/standard/kpienkowska/4698601

Example from the documentation: https://mdbootstrap.com/docs/standard/forms/select/#subsection-multi-selection



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 6.0.0
  • Device: Intel x86
  • Browser: Chrome
  • OS: Ubuntu 22.04
  • Provided sample code: Yes
  • Provided link: Yes