Closed danawoodman closed 1 month ago
In fact, this is the expected behavior
If you simplify your function to pure javascript, you will see that value
is assigned to select
, which does not yet have children
here is an example in pure javascript
https://jsfiddle.net/6csxohn4/
To fix this, you need to set the value after the children have been initialized for example, like this https://jsfiddle.net/1bpz2kah/
Ok cool, thanks for the examples :)
I'm assuming my option using selected
is also perfectly valid?
I'm assuming my option using
selected
is also perfectly valid?
Yes.
When rendering a
select
with avalue
set, the select does not automatically select the item passed in as value:To get the items to select, you have to pass
selected: data.current === i.val.value
in youroption
.Is this expected behavior?