View Full Version : cancel key enter

04-14-2010, 02:21 PM
Hello, I would like to cancel the Enter key from being pressed like the below, but I would like to do it without the inline onkeydown="return CancelEnterHit(event);" and instead use addEventListener.

Btw, I don't need any cross-browser help. If I can just get this going in FF I should figure the rest out ok(atleast I hope :)).

<script type="text/javascript">
function CancelEnterHit(e){
if(e.keyCode == 13)
return false
return true;
<input onkeydown="return CancelEnterHit(event);" id="cancelme" />

04-15-2010, 09:55 PM
Is this a tuff one or did I break a forum rule or something lol? echoooooooo...