Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react detect enter key

var Input = React.createClass({
  render: function () {
    return <input type="text" onKeyDown={this._handleKeyDown} />;
  },
  _handleKeyDown: function(e) {
    if (e.key === 'Enter') {
      console.log('do validate');
    }
  }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #detect #enter #key
ADD COMMENT
Topic
Name
7+8 =