• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

234
Vistas
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?

about 3 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

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

about 3 years ago · Santiago Trujillo Denunciar

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.

about 3 years ago · Santiago Trujillo Denunciar

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)"

about 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda