<form action="#">
<input type="text" id="txtBox" name="txt" onkeypress="handle" />
</form>
<script>
$("#txtBox").keypress(function (e) {
if (e.keyCode === 13) {
alert("Enter was pressed was presses");
}
return false;
});
</script>