Topic: Disable Form Submit FF 2.0} (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=30604" title="Pages that link to Topic: Disable Form Submit FF 2.0} (Page 1 of 1)" rel="nofollow" >Topic: Disable Form Submit FF 2.0} <span class="small">(Page 1 of 1)</span>\

 
Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

posted posted 10-18-2008 13:04

Does anyone know how to disable the default behaviour of a form submit when hitting the enter key? Specifically with FF 2.0, as it is not working for this browser. I am doing this:

code:
if(event.keycode == 13)   // do nothing with enter key (select dropdown instead)
        return false;



This occurs in the onkeypress event of an input element.

Thanks!

Karl..

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 10-18-2008 15:33

Try stopping the propagation, and the default action.
event.stopPropagation();
event.preventDefault();

HTH

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

posted posted 10-19-2008 05:40

That works. Thanks!



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu