Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Submit forms with ctrl/cmd + enter
window.addEventListener('load', function(){
forms = document.getElementsByTagName('form')
for (form of forms) {
form.addEventListener('keydown', function(e) {
if (e.keyCode == 13 && e.metaKey) {
$button = form.querySelector('button[type="submit"]')
$button.click()
return false
}
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.