Created
January 18, 2012 19:33
-
-
Save mhairston/1635073 to your computer and use it in GitHub Desktop.
Enable Enter Key in JMVC Event Handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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