Some times you want to disable the form submission when someone hits the enter key.
Here is how to do it.

[code language="javascript"]
// Ignores the enter key to prevent accidental form submission.
// Usage:
// src:
// src:
function my_ignore_enter(e) {
var characterCode;

if (window.event) { // IE
characterCode = e.keyCode;
} else if(e.which) { // Netscape/Firefox/Opera
characterCode = e.which;

if (characterCode == 13) {
return false;

return true;


Referral Note: When you purchase through an referral link (if any) on our site, we earn a commission.