Well, you don't have a key-
or charCode
in event.which
within a click event handler, so this doesn't make much sense at all. You would need to bind a keypress
event to one or more input-text controls, where the user may type in (and therefore, trigger a return).
$('input:text').bind('keypress', function(e) {
if( e.which === 13 )
return false;
});
returning false
from an event handler causes two things:
- .preventDefault() is called on the event object
- .stopPropagation() is called on the event object
that should stop the return
from bubbling up to your <form>
node, which in turn prevents the submit. So, it's actually enough to call e.stopPropagation()
here.