I am trying to disable submitting a form when the user presses enter on input fields, but I can't seem to get anything to work. The latest script I've tried was adding this to the head:
<script type="text/javascript">
$(document).ready(function() {
$(window).keydown(function(event){
if(event.target.tagName != 'INPUT') {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
}
});
});
</script>
I am not receiving any errors in the console so I can't tell if something is conflicting.
$('form').on('submit', function(e) { e.preventDefault(); })