event.target.selectedOptions IE Bug
See original GitHub issueCurrently the synthetic event fired from select element’s onChange prop has no selectedOptions property in IE11 (most likely earlier versions as well). event.nativeEvent.srcElement.value appears to work in all browsers.
This works in Chrome:
event.target.selectedOptions[0].value.
In IE:
event.target.selectedOptions === undefined;
Can this be polyfilled to be consistent across browsers or is the assumption developers should use event.nativeEvent.srcElement.value?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
event.target.selectedOptions IE Bug - JSFiddle
The fiddle listings (Public, Private, Titled, etc) will now display latest versions instead of the ones saved as Base versions - this was...
Read more >React currentTarget.selectedOptions[0].value is failing in IE 10 ...
One question - I looked for other ways and found this one - just using event.target.value per stackoverflow.com/a/28868135/2532070 Both appear ...
Read more >HTMLSelectElement.selectedOptions - Web APIs | MDN
This script sets up a click event listener on the "Order Now" button. When clicked, the event handler fetches the list of selected...
Read more >How To Handle Dropdowns In Selenium WebDriver Using ...
While dealing with access forms, you'd often have to handle dropdown. Here's how you can handle them with Selenium WebDriver in Selenium ...
Read more >API - React Select
If you wish to overwrite a component, pass in an object with the appropriate namespace. ... Whether to block scroll events when the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(Sounds like you want
event.target.value
.)Ok, I ran the fiddle in IE11. Best as I can tell,
event.nativeEvent.srcElement === event.target
, and is the DOM node. It looks like IE11 no longer supportsselectedOptions
on the select DOM node, which is odd because it appears to be supported by Edge, but that’s life.selectedOptions
is not part of the spec, and even if it were, I don’t think we’d want to be polyfilling the actual dom nodes.Anyway, I think this has nothing to do with our synthetic events. The “problem” is occurring when the browser reads directly from a DOM node. Unless I’m missing something, no further action is necessary here.