How to check if enter was pressed in jQuery

To check if enter was pressed in jQuery you can use the following snippet.

Sample jQuery

 $('#element').keyup(function(e) {
	if(e.keyCode == 13) {
		alert('Enter was pressed.');
	}
});

Please Share us:
Please rate this snippet

2 thoughts on “How to check if enter was pressed in jQuery

Leave a Reply