Try this:
$('#myText').on("keypress", function(e) {
if (e.keyCode == 13) {
alert("Enter pressed");
return false; // prevent the button click from happening
}
});
Try this:
$('#myText').on("keypress", function(e) {
if (e.keyCode == 13) {
alert("Enter pressed");
return false; // prevent the button click from happening
}
});