Created
June 28, 2017 09:58
-
-
Save iiic/50ae07629a5fca17c4cc6b958bdbe547 to your computer and use it in GitHub Desktop.
Odeslání jakéhokoliv formuláře na stránce pomocí zkratky CTRL+Enter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
var forms = document.getElementsByTagName('form'); | |
for (var i = 0; i < forms.length; i++) { | |
var singleForm = forms[i]; | |
singleForm.addEventListener('keydown', function(event) { | |
if (event.ctrlKey && event.key === 'Enter') { | |
singleForm.submit(); | |
} | |
}); | |
} | |
}()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bacha na to … na Linuxu se Chrome chová jinak… nemá například key event
altKey
:
false
bubbles
:
true
cancelBubble
:
false
cancelable
:
true
charCode
:
0
code
:
"Enter"
ctrlKey
:
false
currentTarget
:
null
defaultPrevented
:
false
detail
:
0
eventPhase
:
0
isTrusted
:
true
isTrusted
:
true
keyCode
:
13
keyIdentifier
:
"Enter"
location
:
0
metaKey
:
false
path
:
Array[7]
repeat
:
false
returnValue
:
true
shiftKey
:
false
sourceCapabilities
:
InputDeviceCapabilities
srcElement
:
textarea
target
:
textarea
timeStamp
:
9320.025000000001
type
:
"keydown"
view
:
Window
which
:
13