Skip to content

Instantly share code, notes, and snippets.

@sulram
Created February 8, 2014 19:12
Show Gist options
  • Save sulram/8888588 to your computer and use it in GitHub Desktop.
Save sulram/8888588 to your computer and use it in GitHub Desktop.
$.fn.ctrlEnter = function (btns, fn) {
var thiz = $(this);
btns = $(btns);
function performAction (e) {
fn.call(thiz, e);
}
thiz.bind("keydown", function (e) {
if (e.keyCode === 13 && e.ctrlKey) {
performAction(e);
e.preventDefault();
}
});
btns.bind("click", performAction);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment