0

I am needing to wrap text within a text input. I know that textareas have this functionality by default, but I need to use a text input to allow for submit on enter. Pressing enter in a textarea just brings you to a new line.

I've tried word-wrap and word-break, but those don't work.

Jose Rodriguez
  • 9,753
  • 13
  • 36
  • 52
kiaaanabal
  • 366
  • 2
  • 12

1 Answers1

1

Since you cannot wrap an input your best option would be to disable the enter in a text area, see fiddle: https://jsfiddle.net/c259LrpL/11/

<textarea id="something"></textarea>
<script>
$("#something").keydown(function(e){
if (e.keyCode == 13 && !e.shiftKey)
{
  e.preventDefault();
  return false;
  }
});
</script>
Adam Buchanan Smith
  • 9,422
  • 5
  • 19
  • 39