Last active
May 4, 2024 12:24
-
-
Save KacperKozak/9736160 to your computer and use it in GitHub Desktop.
[Ctrl] + [Enter] to submit forms
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
document.body.addEventListener('keydown', (event) => { | |
if(event.key === "Enter" && (event.metaKey || event.ctrlKey)) { | |
event.target.form?.submit(); | |
} | |
}); |
beautiful thing i have ever seen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're correct. This snippet is from 9 years ago, but it has been updated now :)