Skip to Content Skip to Menu

Disable enter key on form submit - (keycode 13)

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.