Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  65] [ 5]  / answers: 1 / hits: 54978  / 11 Years ago, thu, october 3, 2013, 12:00:00

On one of my pages, I have a text area html tag for users to write a letter in. I want the content below the text area to shift down, or in other words, I want the text area to resize vertically with each line added to the text area and to have the content below simply be positioned in relation to the bottom of the text area.



What I am hoping is that javascript/jquery has a way to detect when the words wrap, or when a new line is added and based on that do a resize of the text area container.



My goal is to make the content below the text area stay the same distance from the bottom of the text no matter how much a user writes.



The text area creates a scroll bar when the text overflows.


More From » jquery

 Answers
7

http://www.jacklmoore.com/autosize/



Download the plugin first:



Step 1: Put jquery.autoresize.min.js where you keep your jquery plugins.



Step 2: Link the file in HTML -> <script src=jquery.autosize.min.js type=text/javascript ></script> Be sure that this link comes after your jquery link, and before your own javascript/jquery code links.



Step 3: In your javascript code file simply add $('#containerToBeResized').autosize();


[#75242] Thursday, October 3, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harleyterryp

Total Points: 290
Total Questions: 92
Total Answers: 95

Location: Montenegro
Member since Sun, May 7, 2023
1 Year ago
;