Detect enter key hit using jQuery
Published on 3 July 2013 at 14:33 by
Just a little snippet today, for future reference more than anything.
$('.textbox').bind('onEnter', function(e) {
// your code here
});
$('.textbox').keyup(function(e) {
if (e.keyCode == 13)
$(this).trigger('onEnter');
});
It's pretty much self-explanatory. When enter is pressed, the above function fires.