Skip to content
Textarea실무 경험

How to Apply Line Breaks Typed in a Textarea to an Input

1 min readWorkMoved from my Tistory blogRead the Korean original

In my case, I took the line breaks from the Textarea, which appear as \n in the string, matched them with /\n/g using replace, and changed them to a ' ' character.

js
console.log(bookingRequestDetail?.data.memo?.content.replace(/\n/g, ' '));
  • #input line breaks
  • #textarea line breaks

More in Work