Skip to content

Instantly share code, notes, and snippets.

@AucT
Created April 25, 2022 10:16
Show Gist options
  • Save AucT/15f6e8656b665562f7f6c65224e49b32 to your computer and use it in GitHub Desktop.
Save AucT/15f6e8656b665562f7f6c65224e49b32 to your computer and use it in GitHub Desktop.
Pressing ctr+enter inside textarea will requestSubmitForm.
document.body.addEventListener('keydown', function (e) {
if (e.key === 'Enter' && e.target.localName === 'textarea' && (e.metaKey || e.ctrlKey) && e.target.form) {
e.target.form.requestSubmit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment