10 examples of 'javascript keypress' in JavaScript

Every line of 'javascript 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
408function keypress(e: KeyboardEvent) {
409 if (app.active) {
410 app.keyPress(e);
411 }
412 }
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

14function keypress(event)
15{
16 iowrapper.send(String.fromCharCode(event.which), parseResponse);
17}
387keyPress(key: string): void {
388 const keydownEvent: any = document.createEvent('CustomEvent');
389 keydownEvent.key = key;
390 keydownEvent.ctrlKey = false;
391 keydownEvent.metaKey = false;
392 keydownEvent.initEvent('keydown', true, true);
393 this.target.editor.root.dispatchEvent(keydownEvent);
394
395 const keyupEvent: any = document.createEvent('CustomEvent');
396 keyupEvent.key = key;
397 keyupEvent.ctrlKey = false;
398 keyupEvent.metaKey = false;
399 keyupEvent.initEvent('keyup', true, true);
400 this.target.editor.root.dispatchEvent(keyupEvent);
401}
1function keypress(e){
2 if(e.keyCode == 13) {
3 submitLogin();
4 }
5}
19function keydown(event)
20{
21 //iowrapper.send(chr, parseResponse);
22 switch(event.which) {
23 case 38: // up
24 iowrapper.send("\x1b[A")
25 return false;
26 case 40: // down
27 iowrapper.send("\x1b[B")
28 return false;
29 case 39: // right
30 iowrapper.send("\x1b[C")
31 return false;
32 case 37: // left
33 iowrapper.send("\x1b[D")
34 return false;
35 case 8:
36 case 9:
37 iowrapper.send(String.fromCharCode(event.which))
38 return false;
39 }
40 return true;
41}
47function handleKeyPress(e) {
48 if (e.key === 'Enter' || e.key === ' ') {
49 onClick();
50 }
51}
146keyPressListener(event) {
147 if (event.ctrlKey && event.keyCode === 70) {
148 this.inPageSearch.openSearchWindow();
149 }
150}
397function keypress( event ) {
398
399 key = event.keyCode;
400 val = event.type == 'keyup';
401 keys[ key ] = keys[ keyName( key ) ] = !val;
402
403 trigger( context[ event.type ], event );
404}
18handleKeyPress(event) {
19 const { onSubmit } = this.props;
20
21 if (onSubmit && event.key === 'Enter') {
22 onSubmit(event);
23 }
24}
13function keydown(evt){
14 if (evt.ctrlKey && evt.keyCode == 32){ //CTRL+ALT+F4
15 var search = document.getElementById('search');
16 search.className = 'open';
17 document.getElementById('searchInput').focus();
18 } else if (evt.keyCode == 27) {
19 var search = document.getElementById('search');
20 search.className = '';
21 document.getElementById('searchInput').blur();
22 }
23}

Related snippets