Last Updated: February 25, 2016
·
997
· stevenharman

⌘-ENTER to submit forms.

Make the Internet better, submit forms with ⌘-ENTER.

https://gist.github.com/stevenharman/6054478

3 Responses
Add your response

That is already the default browser behavior. Ctrl+Enter for Windows/Linux and ⌘+Enter for Mac. There is one requisite: You have to put the form fields in a <form> tag for that to work.

http://plnkr.co/edit/LxhESk?p=preview

over 1 year ago ·

Hi @twolfosn,

For your example, ⌘+Enter does nothing for me on my Mac, using latest Chrome. CTRL-Enter, does seem to submit the form. Do you have any links to spec or docs that show this to be the default behavior across browsers?

Also, the solution I presented above handles the case of textarea and select elements - does the default behavior you mentioned handle those?

over 1 year ago ·

Ah, I must have been mistaken then. I am glad to hear Ctrl+Enter still works for form submission.

Unfortunately, a quick Google search does not turn up any results. It seems to be something I have picked up over the years.

The solution above should be applicable to any elements inside of a form (e.g. textarea, select, input[type=*]).

over 1 year ago ·