Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8311609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:52:19+00:00 2026-06-08T19:52:19+00:00

this is my code: (keep it simple) <textarea style=height:100px;> $textareatext </textarea> if $textareatext is

  • 0

this is my code: (keep it simple)

<textarea style="height:100px;">
    $textareatext
</textarea>
  • if $textareatext is 1 line long I want the height of textarea to fit
  • if its 3, 5 or 10 lines…same thing.

The issue I am having is at 100px the height is too big, but if I set it to 20px and there are 10 lines then the textarea height is too small.
NOTE: values are preloaded via mysql. so I think it should count the lines,then set the height based on how many lines ?
Any suggestions?

I use Javascript and jQuery, or anything you would suggest.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:52:22+00:00Added an answer on June 8, 2026 at 7:52 pm

    These may help. They’re both jQuery plugins.

    • jQuery Elastic
    • Flexible Area
    • Autogrow

    Edit

    var $textArea = $("#textarea-container");
    
    resizeTextArea($textArea);
    
    $textArea.off("keyup.textarea").on("keyup.textarea", function() {
        resizeTextArea($(this));
    });
    
    function resizeTextArea($element) {
        $element.height($element[0].scrollHeight);
    }​
    

    This answer was provided by François Wahl, below.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is driving me crazy... With this simple code I keep getting file not
I keep getting an expected identifier error at this line in my code =/
I use this code: I'm trying to remove the categoryPath node but keep its
I have this code and I keep getting undefined if I test the selectedIndex.
i have this php code and keep on getting errors upon fixing each error.
I keep getting 'warning: control reaches end of non-void function' with this code: -
I will keep this quick. The attached code for the most part works i
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate
I keep getting this error whenever I call gethostbyname() in my C code. ==7983==
I keep on getting this error error: expected specifier-qualifier-list for core data code im

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.