mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.35k stars 1.16k forks source link

Select not applyin selected on selection #271

Closed vosco88 closed 4 years ago

vosco88 commented 4 years ago

Expected behavior

Select should mark selected option

Actual behavior

Selected option stays the same

Your working environment and MDB version information

MDB Pro 4.12

Resources (screenshots, code snippets etc.)

image

When I select another item from the dropdown the selected mark stays on the one it is on.

mateuszlubianka1993 commented 4 years ago

Hi, As you can see on MDB docs, the frirst <option></option> should be selected. Like here: <option selected>Open this select menu</option>. If you copy the code from our docs, it should works well

Best,

vosco88 commented 4 years ago

My selected option is coming from the database so that is why I do not have the first option selected. However even if I go here https://mdbootstrap.com/docs/jquery/forms/select/ and try the first form it does not work. This is the state when there is 'Open this select menu' in the select form image And this is the state when I select one of the other options image So the selected tag does not move around which I think is telling the form that always the same item is selected.

mateuszlubianka1993 commented 4 years ago

When selected attribute present, it specifies that an option should be pre-selected when the page loads. If you choose one of the options and consol value, you will see value from option that you selected.