Skip to content

Instantly share code, notes, and snippets.

@mhairston
Created January 18, 2012 19:33
Show Gist options
  • Save mhairston/1635073 to your computer and use it in GitHub Desktop.
Save mhairston/1635073 to your computer and use it in GitHub Desktop.
Enable Enter Key in JMVC Event Handler
// Enable enter key for activating items (equivalent of click)
// * Not needed if target is <a> or <input> or <button>
// * $(el).trigger() should trigger whatever event type the main event handler is responding to.
".nb_inlineAct keyup": function(el,ev) {
ev.stopImmediatePropagation();
if (el.tagName && el.tagName.indexOf('a button input') == -1) {
if(ev.keyCode == 13) { // enter key
$(el).trigger('activate');
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment