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

185
Visualizações
<textarea> not expanding when using \n as newline

I have a code for an Autocomplete input that will add to a textarea element the value that is choosen on the Autocomplete input, as a list seperated by new row.

When adding rows to the textarea seperatly, by pressing Enter for a new row, it expands to fill in the new row and value, however, in my case, when using +('\n') a new line is created but the textarea is not expanding. I guess that it got to do with the functionality of Enter vs \n. So is there a different way to create a newline that textarea will also expand?

My code snippet is:

b.addEventListener("click", function(e) {
          /*insert the value for the autocomplete text field:*/
          document.getElementById('myTxt').focus();
          document.getElementById('myInput').focus();
          myTxt.value += this.getElementsByTagName("input")[0].value + ('\n');
          inp.value = "";
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

  • \r = CR (Carriage Return) → Used as a new line character in Mac OS before X
  • \n = LF (Line Feed) → Used as a new line character in Unix/Mac OS X
  • \r\n = CR + LF → Used as a new line character in Windows
about 4 years ago · Juan Pablo Isaza 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