You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
There are several confusing items here that you need to read the code to determine:
selectedIndex appears to be read-only. From reading the doc, you might reasonably expect mySelector.selectedIndex = 2 to update the selection, but it doesn't.
The valueattr doc and selected docs say that the default value attribute is name. What they don't say is that IF the items don't have name attributes, OR if there's no item with a matching name, then the selected value is treated as an index.
So if you want to be able to select items by index, you need to set valueattr to an attribute that's NOT defined on any of your items.
The text was updated successfully, but these errors were encountered:
Hm. Apparently I should RTFM. All of these things are actually noted in the doc for the individual properties. I feel like they should be clearer in the general discussion though. The workings of the selected property are pretty complicated.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are several confusing items here that you need to read the code to determine:
selectedIndex appears to be read-only. From reading the doc, you might reasonably expect
mySelector.selectedIndex = 2
to update the selection, but it doesn't.The
valueattr
doc andselected
docs say that the default value attribute isname
. What they don't say is that IF the items don't havename
attributes, OR if there's no item with a matchingname
, then theselected
value is treated as an index.So if you want to be able to select items by index, you need to set
valueattr
to an attribute that's NOT defined on any of your items.The text was updated successfully, but these errors were encountered: