Topic: mdb-select selected on load not showing

peter.caitens@gmail.com pro asked 5 years ago


Expected behavior When the mdb-select is loaded with an item selected it should be displayed

Actual behavior When an item is marked as selected the field is shown blank. When you open the drop-down the selected item can be seen as selected in the list.

Resources (screenshots, code snippets etc.) View this code snippet and set an item as selected and the Label continues to be displayed in the field.

https://mdbootstrap.com/snippets/jquery/piotr-glejzer/692528


Piotr Glejzer staff answered 4 years ago


can you add class md-selected to your select? Something like that:

<select class="md-form mdb-select md-selected">
<option value="1" disabled>1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
</select>

Custer priority commented 4 years ago

This works. Thanks!



That works or select's with a selected item. However for selects with nothing pre-selected the label is in the active state with noting in the field.


Piotr Glejzer staff answered 5 years ago


I already fixed this issue. It will be shown an option with 'selected' property on load. It will be available with the next release.


peter.caitens@gmail.com pro commented 4 years ago

I have loaded the 4.8.2 release and the incorrect behaviour is still happening. When a mdb-select has an option selected before the page is rendered the selected option is not shown. Just the label is shown in the field. When you click on the select to expand it you can see that the selected option is highlighted.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.0
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes