Disable Enter Key Within Forms

Submitted by:Pitter Alderson

Date added:22 August, 2012

Category:JavaScript

This JavaScript code within your web page HTML between your HEAD tags

Tags: disable key

Code Snippet:

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

document.onkeypress = stopRKey;
</script>
 
 

Comments