I have a form with a text input.
I managed to prevent ENTER from submitting the form by doing this:
jQuery("#inputTags").keydown(function(event) {
if (event.keyCode == '13') {
event.preventDefault();
tagManagerCreate(true);
return false;
}
});
tagManagerCreate() does some stuff. Sometimes, this function triggers a javascript "alert". For some reason when that happens, the form still gets submitted!