Created on Sat 19.May 2012by Daniel Kouba
This is simple way how to prevent form submit on pressing ENTER. This solution uses javascript with no addon. it works on every important browser IE, FF, Chrome, Safari and Opera.
<script type="text/javascript">
document.onkeypress = keyPress;
function keyPress(e) {
var keycode;
if (window.event) {
// IE compatible
keycode = window.event.keyCode;
} else { // FF , CHROME, OPERA compatible ( standard way )
if (e) {
keycode = e.which;
}
}
//alert("keycode: " + keycode);
if(keycode == 13){
if (e) {
e.preventDefault();
}
if (window.event) {
event.returnValue=false;
event.cancel = true;
}
}
}
</script>

