I want to hit enter key to go to p2.htm or p3.htm according to the input text that I was typing in. And I also want to hit submit1 button to alert(\'no1\') manually.
<
The problem with the accepted solution is that normal submit buttons no longer work. You must script all the buttons.
Here's a better solution that doesn't break non javascript submit buttons. This solution simply tells the browser to not do default behavior when a user hits the enter key on form inputs.
// prevent forms from auto submitting on all inputs
$(document).on("keydown", "input", function(e) {
if (e.which==13) e.preventDefault();
});