How to increase the height of the text area as and when we type to a max of 50px from 18px. then if someone types more the scrollbar should take over. is this possible ?
It can be achieved by using JavaScript and jQuery. Method 1: Using JavaScript: To change the height, a new function is created which changes the style property of the textarea. The height of the textarea is first set to auto. This value makes the browser set the height of an element automatically.
To do that, we simply need to set the height of the <textarea> to 0 momentarily to force the scrollHeight to equal the intrinsic height of the element. Once we get that value, we can simply set the height of the element using the style property - this will force the <textarea> to take up the height of its contents.
You can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse.
The maxlength attribute defines the maximum number of characters (as UTF-16 code units) the user can enter into an <input> or <textarea> .
You can use either of these plugins:
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