Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a hotkey to submit an HTML form?

I have a very simple HTML form, only containing a submit button and a textarea. Is there an easy way to use a hotkey to submit this form, as an alternative to pressing the button?

Thanks in advance :-)

like image 218
Chris Avatar asked Sep 01 '10 13:09

Chris


2 Answers

Submit buttons can have accesskeys, but there are drawbacks. Users would probably be better off just hitting the tab key to focus the submit button, and then pressing enter.

like image 135
Quentin Avatar answered Sep 18 '22 23:09

Quentin


you can use the "keyDown", "keyPress" events if you use a JS library (JQUERY or MOOTOOLS).. you can program your own Ctrl+S to submit.

On JQuery see this http://api.jquery.com/keypress/

On Mootools see this http://mootorial.com/wiki/mootorial/03-native/05-event

like image 29
pleasedontbelong Avatar answered Sep 19 '22 23:09

pleasedontbelong