jQuery HotKeys

Today was spent refactoring a lot of code on a soon to be released project and trying to optimize some data entry screens. It’s important to try to keep the user on the keyboard as much as possible with as few trips back to the mouse if it can be avoided. On the screen in question, they are often going to be adding a lot of new rows to a table. I had refined the data entry down to a pretty quick process but was left with the problem of having to click the “Add xxx” button to add a new row, a very disruptive process.

Enter jQuery HotKeys. This a pretty slick jQuery plugin that allows you to associate a keydown (or keyup etc) event for a given object with a function.

$(document).bind(‘keydown’, ‘ctrl+a includeInput’, function() {add_game(); return false;});

The version I’ve shown has a small modification to allow this happen even when inputs have focus (thanks to Phil Mickelson for that addition!). It added the final refinement I was looking for to allow for really quick data entry.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s