Possible Duplicate:
Jquery growing and shrinking textarea
I want to achieve an effect where a text <input> will grow vertically when the text overflows. So instead of the beginning text being scrolled off, a new line starts, and the <input> grows vertically.
How could I achieve this using Javascript/jQuery/CSS/HTML/etc?
You probably can use an autogrowing textarea styled as an input - DEMO
textarea {
height: 20px;
line-height: 20px;
resize: none;
}
There are numerous plugins exists to achieve the same effect - I used this for the demo.
A pure Javascript way:
<textarea onkeyup="while(this.scrollTop > 0) {this.rows++;}"></textarea>
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