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

180
Views
<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 answers
Answer question

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 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!