<script type="text/javascript">
$('form').on("keyup keypress", function(e) {
  var code = e.keyCode || e.which;
  if (code  == 13) {
    e.preventDefault();
    return false;
  }
});
</script>

<script type="text/javascript">
$('form').on("keyup keypress", function(e) {
  if(!$("textarea").is(":focus")) {
    var code = e.keyCode || e.which;
    if (code == 13) {
      e.preventDefault();
      return false;
    }
  }
});
</script>

Allow pressing enter for newlines when in a textarea.
Allow pressing enter for newlines when in a textarea.
