Topic: material_select multiple initially shows the first option which is incorrect.

joeynovak pro asked 4 years ago


On 4.4.5

If you use a multi select material_select() and you initially select no options it will show the first option in the label, even though it isn't checked.  It behaves correctly if you check, and then un-check an option.

To fix this, I changed line 39 of material-select.js to be:

var label = $select.find('option:selected').html() || (!$select.is("[multiple]") && $select.find('option:first').html()) || '';

Jakub Strebeyko staff answered 4 years ago


Hi there Joey, Thanks for reaching out! Your effort to make MDB better is highly appreciated. For anyone still finding it difficult to get Material Select to work despite applying the above mentioned fix, please be sure to check out the newest MDB 4.5 release and the long list of problems it solves. With Best Regards, Kuba

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

  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No
Tags