JSFiddle: https://jsfiddle.net/ypcrumble/kj2b8dk7/4/
The following code is a simplified version of a problem I'm facing in a React 12.2 app using JSX, on IE 10. Specifically, the line
var postData = rsvp.currentTarget.selectedOptions[0].value;
fails in IE. It works in Chrome and Firefox. First, why does this fail in IE10, and second, how can I adjust the code to make it work?
var Hello = React.createClass({
getInitialState: function() {
return {parsed: false};
},
_onRSVP: function(rsvp) {
console.log(rsvp);
var postData = rsvp.currentTarget.selectedOptions[0].value;
this.setState({parsed: true});
alert(postData);
},
render: function() {
var parsing = "parsing worked";
return (
<div>
<select
onChange={this._onRSVP}>
<option value="----">----</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
<p>
{ this.state.parsed ?
{parsing}
: null}
</p>
</div>
);
}
});
React.render(<Hello name="World" />, document.getElementById('container'));