0

can you please tell me how to resize the height of textarea to to content.?

http://jsfiddle.net/PT6Lp/ But default the size of text area is same when you run fiddle (when there is no content ).But when you enter some text in text area it size is increase.But not if user move focus from text area to any other like input fied it comes to default size.but if focus come again to textarea it regain it size to content size.

 <textarea name="textarea" id="textarea"></textarea>
    <input type="text" name="name" id="name" value=""  />
  • Why do you want to do that...wont it be a better Ui practice to use scrollbars when the content overflows the box? – shanks Apr 17 '14 at 00:18
  • I already use overflow:auto -webkit-scroll......But it not work in IPAD –  Apr 17 '14 at 00:20
  • Can you suggest other way –  Apr 17 '14 at 00:23
  • I answer this question here: [How To Create Input Field That Gets Taller](http://stackoverflow.com/questions/19286434/how-to-create-input-field-that-gets-taller). – Robbie Wxyz Apr 17 '14 at 00:27

1 Answers1

0

I don't know exactly why but by choosing jQuery Mobile library (never used it before) I could not modify the appearance of the textfield. Probably because of different UI settings forced from jQuery mobile. Like larry said scrollbars in mobile are not that great.

Anyway, you can either set the attributes cols & rows directly or style it with CSS width & height

See updated fiddle

Empi
  • 94
  • 1
  • 9