Last active
September 25, 2017 22:57
-
-
Save seompark/0c37b06e75d81f47729b66fc5e07bb3c to your computer and use it in GitHub Desktop.
form ctrl + enter submit
This file contains hidden or 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
const form = document.querySelector('#form') | |
function submit (e) { | |
e && e.preventDefault() | |
// ... | |
} | |
form.onsubmit = submit | |
form.onkeydown = e => (e.ctrlKey && e.keyCode === 13 && !!submit()) || e.keyCode !== 13 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment