Disable Enter key in the form using JavaScript

JavaScript          Trackback

Have an HTML form on your site and sometimes you are receiving incomplete submissions? Ever wonder why? I’ll tell you. Many times your visitors are hitting the ‘Enter’ key instead of the ‘Tab’ key, and pressing ‘Enter’ button is not taking them to next field but submits the form, and that is causing incomplete form submissions.
Place this JavaScript snippet between your HEAD tags:
Use this simple JavaScript snippet, put it before tag, and that should disable the ‘Enter’ key within your form.

<script type="text/javascript"> function noEnter(e) { var e=(e)?e:((event)?event:null); var field=(; if ((e.keyCode==13)&&(field.type=="text")) {return false;} } document.onkeypress = noEnter; </script>