Skip to content

Instantly share code, notes, and snippets.

@danstuken
Created April 10, 2012 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danstuken/2352702 to your computer and use it in GitHub Desktop.
Save danstuken/2352702 to your computer and use it in GitHub Desktop.
Trap Backspace to prevent dialog closing.
function portfolioEditorDialogdialogRequestedHandler() {
$(document).bind('keydown', function (event) {
if (event.which == 8) {
var target = $(event.target);
if (!target.is('input'))
event.preventDefault();
}
});
}
function portfolioEditorDialogdialogUnrequestedHandler() {
$(document).unbind('keydown');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment