I use the jQuery UI datepicker to let the user select a date. It has some shortcuts so that it can be controlled using the keyboard:
page up/down - previous
If you want to replace one of the shortcuts and do not like coping the code from the repository in case of updating the jquery ui library, use:
// original key down callback
var doKeyDown = $.datepicker._doKeyDown;
$.extend($.datepicker, {
_doKeyDown: function(event){
if(event.which !== $.ui.keyCode.ENTER) {
doKeyDown(event);
}
else {
//do something else
}
}
});
Keep a reference of _doKeyDown before you overwrite it and call it for all other shortcuts.