How to disable the Enter key

By | 10th January 2017

In this tutorial, Show you how to disable the “Enter” Key. If you have an HTML form on your web page, many times your visitors may hit the ‘Enter’ key on their keyboard.

Disabled Enter Key Example :

<script type=”text/javascript”>
function stopenterKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = ( ? : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type==”text”)) {return false;}

document.onkeypress = stopenterKey;


Leave a Reply

Your e-mail address will not be published. Required fields are marked *