I’m a big fan of keyboard control in productivity applications. I love being able to type my changes/additions and submit them without needing to tab around too much, or gasp grab the mouse. I’m not the only one who feels this way. David Walsh has a great post explaining how to submit web forms with Command+Enter. However, for my needs I needed to tweak this a little:
- I only want Command+Enter to submit the form if I’m in a textarea.
- I need the form submission to play nicely with AJAX requests, specifically when using jQuery delegates to catch the form submission. In David’s example code, the
submit()was firing before the delegate could catch the event and
Luckily it was quite simple to adapt his code for my needs.