Live Chat Icon For mobile
Live Chat Icon

How can the ‘Enter’ key be disabled?

Platform: ASP.NET| Category: Client Side Scripting

In order to avoid the Form Submission by pressing the ’Enter Key’ you have to write following code on the KeyPress Event Of the Body Tag

function DisableEnterKey()
     if (window.event.keyCode == 13) 
                    event.cancel = true;
<body onkeydown="DisableEnterKey();">

Share with

Related FAQs

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

Please submit your question and answer.