JsFiddle: https://jsfiddle.net/69z2wepo/9956/
I am returning a select element in a render function in my react.js code.
But whenever I change the select value, the function in onChange does not start.
var Hello = React.createClass({ render: function() { return <select id="data-type" onChange={changeDataType()}> <option selected="selected" value="user" data-type="enum">User</option> <option value="HQ center" data-type="text">HQ Center</option> <option value="business unit" data-type="boolean">Business Unit</option> <option value="note" data-type="date">Try on </option> <option value="con" data-type="number">Con</option> </select> } }); React.render(<Hello/>, document.getElementById('container')); function changeDataType() { console.log("entered"); }
This function only runs once when the selection is loaded, and then when I change the value, it does not start.
source share