Submitting a Form with the Enter Key

Submitting a Form with the Enter Key

Using the IE browser application, you can press the key while filling a form to submit the form. Indeed, this is a desirable feature for any Windows application. In order to make this work for all browser applications, you just need to add a few lines of code.

The method explained here traps the keyboard events to implement this. This works on all browsers ?it was tested on Internet Explorer, Netscape Navigator, Mozilla and Opera.


‘myForm’ identifies the form to be submitted. If the document has several forms, you may need additional logic to determine which form to submit.


Share the Post: