Back to Top

Automatically Resize text area to fit content

Resize text area to fit all text on load

In this short tutorial, I am going to explain about how to resize text area to adjust all text on load.

Sometimes you have long text and text will not display better when you want to edit and if you apply width and height, it will fix the width and height with small content.

so, I have found the solution for Resize Textarea based on added data. Its working fine in Android and Iphone also.



Here is the solution:


$("#txt1").val("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.").height( $("#txt1")[0].scrollHeight );

Recommended Read:

To use JSON Response of Webservice in Phonegap Android
Getting Started With PhoneGap

Hope this helps someone else out.As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How To use Store Procedure with PDO

Posted on 7 years ago

Bhumi

Warning: Ignoring WordPress Can Be a Blunder

Posted on 6 years ago

Nick Carter

To access windows shared files in ubuntu

Posted on 6 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 3 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 4 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 4 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 5 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 5 years ago

Bhumi