Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda