-
Articles
-
jQuery
-
Disable enter key on form submit - (keycode 13)
Disable enter key on form submit - (keycode 13)
- Posted: 1st February 2010
- Created by: Robert
- Found in: jQuery
I needed to disable the enter key on a particular form field and was able to find this solution.
$('input#form_id').keypress(function (event){ return event.keyCode == 13;});
Note that this is a simplified version of what I did, but basically it returns false when the enterkey (keyCode 13) is pressed.