Created
December 19, 2012 03:52
-
-
Save michaelbramwell/4334260 to your computer and use it in GitHub Desktop.
jQuery func enter key
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
$.fn.enterKey = function (fnc) { | |
/// <summary>Power Search: Enter Key press</summary> | |
/// http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes | |
return this.each(function () { | |
$(this).keypress(function (ev) { | |
var keycode = (ev.keyCode ? ev.keyCode : ev.which); | |
if (keycode == 13) { | |
fnc.call(this, ev); | |
} | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment