mithril.js: Select doesn't work in Mithril in IE browser
Mithril version: I don’t know version of Mithril, because this version doesn’t contain m.version.
But I looked commits and this Mithril version has been added in 1 Jul 2015.
When I choose option in IE(10, 11), selected value doesn’t show. Field of selector is empty.
In other browsers it works correctly.
View generation:
m "select.selector", {
disabled: !ctrl.overrideLocales(),
value: ctrl.locale(),
onchange: m.withAttr("value", ctrl.locale)
},
[mapArray(locales)]
mapArray method:
view : (ctrl) ->
mapArray = (arr) ->
m "option", [val.name ? val] for val in arr
If I paste attribute selected to option element in Developer Tools, it’s displayed correctly in IE browser. But mithril doesn’t allow me to insert this attr to element.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (12 by maintainers)
@gyandeeps Works in IE11/Edge, nice catch 👍
https://jsbin.com/girulokepu/1/edit?js,output
@Grinv Looks like for IE you need to add specific
values to each<option>, otherwise setting avalueon the<select>won’t do what you expect.@barneycarroll If you’re okay with it, feel free to add that section yourself. 😃
On Mon, Mar 14, 2016, 14:58 Barney Carroll notifications@github.com wrote:
Here is the solution:
I think i have seen this happen with IE regardless if you use mithril or not. I think IE needs
valueproperty on options.