Topic: Unselecting all options of a material design multiselect using jquery

Jorge Nuñez Malledo free asked 4 years ago


I would like to unselect all previously-selected option in a multiselect list when a button is clicked. After several attempts, I finally succeed with the following code: $('#myMultiselect').val(""); But this also affects the save button of the multiselect :(

I tried the following, with no results: $('#myMultiselect option:selected').val(''); $('#myMultiselect ').removeAttr('selected');

Thank you!


Marta Wierzbicka staff answered 4 years ago


Hi,

would you create a snippet showing the problem here: https://mdbootstrap.com/snippets/. I'll try to help you.

Best, Marta


Jorge Nuñez Malledo free commented 4 years ago

Never mind Marta, Honestly, I didn't find the "save" button useful in my app...


Marta Wierzbicka staff commented 4 years ago

Hi,

do you need more help?

Best, Marta



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: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.2
  • Device: Thinkpad T480
  • Browser: Firefox Quantum 67.0.4 (64-bit)
  • OS: Red Hat Enterprise Linux Server
  • Provided sample code: No
  • Provided link: No