The following function checks if the key code is 13 or the Enter key is equal. If so, the function calls the submitformnow function.
<script type="text/javascript"> function submitform(myfield, e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; if (keycode == 13) { submitformnow(); return false; } else return true; } function submitformnow(){document.myform.submit();} </script>
Then in your text box put onkeypress="return submitform(this, event)" .
source share