Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textarea Height increase

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 ?

like image 590
Harsha M V Avatar asked Nov 14 '10 08:11

Harsha M V


People also ask

How can I increase my height in text area?

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.

How increase textarea height dynamically react?

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.

How do I resize a textarea in HTML?

You can resize a textarea by clicking on the bottom right corner of the textarea and dragging the mouse.

Does Maxlength work on textarea?

The maxlength attribute defines the maximum number of characters (as UTF-16 code units) the user can enter into an <input> or <textarea> .


1 Answers

You can use either of these plugins:

  • TextAreaExpander (Demo)
  • autoResize Plugin
like image 64
Sarfraz Avatar answered Nov 15 '22 05:11

Sarfraz