kiaaanabal kiaaanabal - 2 years ago 130
HTML Question

Wrap text within in a text input

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. I'm assuming this is impossible, but I don't want it to be haha :)

Any help is appreciated!

Answer Source

Since you cannot wrap an input your best option would be to disable the enter in a text area, see fiddle:

<textarea id="something"></textarea>
if (e.keyCode == 13 && !e.shiftKey)
  return false;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download