How to invoke react handler using jquery val() method?
Below is a simple react component with input field. Whenever the value changes the onChange event handler is fired and value is set to state of the component.
var Hello = React.createClass({
getInitialState: function(){
return {
val: this.props.defVal || ""
};
},
onChange: function(event){
var newVal = event.target.value;
console.log("changed", newVal);
this.setState({val: newVal});
},
render: function() {
return <div>
<input id = "asd" className = "asd" value = {this.state.val} onChange = {this.onChange}/>
Hello {this.props.name}</div>;
}
});
React.render(<Hello name="World" />, document.getElementById('container'));
However the onChange handler is not fired when i use jquery val method. Like $('#asd').val("asd");
Is there a way i can invoke the handler using jquery val function?