Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
What is the best autogrow textarea plugin for jQuery?

There seem to be a ton of really bad autogrow textarea plugins for jQuery. I want my autogrowing text box to be as good as Facebook's. I want it to fit the current line only, and add a line right before it's needed.

Most of the plugins I've reviewed try to guess line height from number of characters, which seems too naive. I've read one solution that creates a hidden div to calculate height. That seems like the right path, but that solution wasn't in plugin form.

What's out there that does what I want and is easy to install?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Try it. http://www.jacklmoore.com/autosize I thing here's the best. It's a very good one.

over 4 years ago · Santiago Trujillo Report

0

I have a plugin that calculates just that: http://www.mostthingsweb.com/2012/01/textarea-line-count-version-1-3-released/. It uses the hidden div approach, and even matches the correct font attributes. Check it out :)

You could invoke the plugin every time a user hits a key in the textbox, and then resize the textbox accordingly. Maybe even every other key, if you want to not hog processing power.

over 4 years ago · Santiago Trujillo Report

0

hey this is pure javascript

function sz(t) {
    dv = document.createElement("div");
    dv.style.visibility="hidden";
    dv.style.position="absolute";
    dv.style.width=t.offsetWidth;
    dv.innerHTML = t.value.replace(/\n/g, "<br>");
    document.body.appendChild(dv);
    t.style.height=(dv.offsetHeight+22)+"px";
    dv.parentNode.removeChild(dv);
}

then you just use onkeyup="sz(this)"

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!