1//jQuery detect user pressing enter
2$(document).on('keypress',function(e) {
3 if(e.which == 13) {
4 alert('User pressed Enter!');
5 }
6});
1$('#textbox').keypress(function(event){
2 var keycode = (event.keyCode ? event.keyCode : event.which);
3 if(keycode == '13'){
4 alert('You pressed a "enter" key in textbox');
5 }
6});
1var e = jQuery.Event("keydown");
2e.which = 13; //choose the one you want
3e.keyCode = 13;
4$("#theInputToTest").trigger(e);
5