Topic: Multiselect not working with preselected values
Hi
I have this code:
<div class="md-form"> <i class="fa fa-cutlery prefix"></i> <select class="mdb-select colorful-select dropdown-primary ml-5" multiple="multiple" required="required" name="services"> <option value="#" disabled="disabled" selected="selected">Please, select</option> <option value="svs1">service 1</option> <option value="svs2">service 2</option> <option value="svs3" selected="selected">service 3</option> <option value="svs4">service 4</option> <option value="svs5">service 5</option> <option value="svs6" selected="selected">service 6</option> <option value="svs7">service 7</option> </select> <label>Services</label> </div>But when i execute the souce, the pre-selected options are not shown as selection. I've tried with this:
$('.mdb-select').each(function() { $(this).material_select('destroy'); $(this).material_select(); })But still the same. Looking inside de source code, there is no place for preselected options. How and where should i change the code for this to work? Thanks
Add comment
Mikołaj Smoleński staff answered 7 years ago
Hi,
Your code works fine. Maybe there is something else wrong - try to inspect the rest of the code or update MDB to the latest version.
Regards
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: No
- Provided link: No