<TextField
onChange={ (event , value) => {
console.log(event);
}
}
hintText="Add User Expression"
/>
enter key event is not coming.
I can not understand your issue, @KARTIK01, can you please elaborate better and also provide a running snippet of what you are trying to accomplish?
i was trying to say that, in TextField
onChange
event is not called when user presses Enter key (↵)
<TextField
onChange={ (event , value) =>
console.log(event)
}
hintText="Press Enter"
/>
how can i solve this. please help me out.
@KARTIK01 If you add an onKeyPress event handler to the TextField, you can then check the character code for the enter key:
<TextField onKeyPress={this._onKeyPress}/>
_onKeyPress(event) {
if (event.charCode === 13) { // enter key pressed
event.preventDefault();
// do something here
}
}
Most helpful comment
@KARTIK01 If you add an onKeyPress event handler to the TextField, you can then check the character code for the enter key: