10 examples of 'on enter keypress' in JavaScript

Every line of 'on enter keypress' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
57public keyupEnterHandler(event: KeyboardEvent) {
58 if (Key.Util.isEnter(event.keyCode)) {
59 this.setValue();
60 }
61}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

9handleKeyPress(e) {
10 this.props.onChange({searchTerm: e.target.value});
11}
52selection.on("keypress.enter", function keypress () {
53 if (d3.event.key === "Enter") { this.blur() }
54})
16onKeyPress(e) {
17 if (e.keyCode === 13) {
18 this.props.onEnter(this.state.value);
19 this.setState({ value: '' });
20 }
21}
408function keypress(e: KeyboardEvent) {
409 if (app.active) {
410 app.keyPress(e);
411 }
412 }
146keyPressListener(event) {
147 if (event.ctrlKey && event.keyCode === 70) {
148 this.inPageSearch.openSearchWindow();
149 }
150}
142function onSearchKey(e) {
143 var target = e.target;
144
145 if (target.test('input,select,textarea')
146 || target.get('isContentEditable')) {
147 return;
148 }
149
150 e.preventDefault();
151
152 inputNode.focus();
153 focusManager.refresh();
154}
34onkey(event: KeyboardEvent) {
35 if (event.metaKey || event.shiftKey || event.ctrlKey || event.altKey) return;
36 if (event.type == 'keyup') {
37 if (event.key == 'Escape' && document.activeElement.outerHTML == this.inputfield.outerHTML) {
38 this.inputfield.blur()
39 }
40 if (event.key == '/' && document.activeElement.tagName != 'INPUT') {
41 this.inputfield.focus()
42 }
43 }
44 if (event.type == 'keydown' && document.activeElement.tagName != 'INPUT') {
45 if (event.code.startsWith('Key')) {
46 this.inputfield.focus()
47 this.query = (this.query || '') + event.key
48 }
49 }
50}
25onKey(e: KeyboardEvent): void {
26 this.data = e.key;
27}
26_onKeyPress(event) {
27 this._forwardEvent('keypress', event);
28 // Handle: Ctrl + C
29 if (event && event.ctrlKey && event.key === 'c') {
30 process.exit(0);
31 }
32}

Related snippets