The HTML shown below,
<input type="text"/>
is displayed in a browser like so:
The quick brown fox jumped over the lazy dog.
Using the HTML below,
<input type="text" value="The quick brown fox jumped over the lazy dog."/>
it is displayed in a browser like so:
You can't wrap text in a text input box, so perhaps you should use a textarea.
Enable or disable text wrapping for a text box, rich text box, or expression box. Right-click the control for which you want to enable or disable text wrapping, and then click Control Properties on the shortcut menu. Click the Display tab. Select or clear the Wrap text check box.
That is the textarea
's job - for multiline text input. The input
won't do it; it wasn't designed to do it.
So use a textarea
. Besides their visual differences, they are accessed via JavaScript the same way (use value
property).
You can prevent newlines being entered via the input
event and simply using a replace(/\n/g, '')
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With