I have a web app I’m developing and I’m trying to have CTRL+S and COMMAND+S be the shortcut keys to save. I’ve looked at http://www.openjs.com/scripts/events/keyboard_shortcuts/ and it doesn’t properly capture the “meta” key.
Any advice?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Latest Edit: Please, before downvoting this response take in mind that this is a very old response (2011) and has not been updated. Obviously there are better responses now (like the one by lapin) but that doesn’t mean that mine is invalid.
You can use jquery hotkeys.
Download the latest version and modify it following the changes in this attachment: http://code.google.com/p/js-hotkeys/issues/detail?id=26
You only need to add three lines:
At line 188 aprox. (under
ctrl = event.ctrlKey,) add this:Then, add a negation to the if at line 203 aprox. (
if(!shift && !ctrl && !alt){):Finally, under
if(shift) modif += 'shift+';add this:Now when you create a binding to
command+whateverit will grab it:Here you can grab the latest current version (0.7.9) modified: