Live Chat Icon For mobile
Live Chat Icon

How can I trigger a submit on my form when the enter key is pressed

Platform: ASP.NET| Category: Miscellaneous

Add this to the body element:


<body MS_POSITIONING='GridLayout' onkeypress='if(window.event.keyCode==13){ document.Form1.submit();}'>
...
</body>

Also check out Andy Smith’s DefaultButton Control which triggers submit selectively on one of many buttons based on the context.

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.