0

I am working on an "article reformatter" where I have some input boxes for article title, author, logo, etc

And for the content of the article, I have a textarea, and I want users to be able to copy-and-paste an article into this textarea, including returns/line breaks.

The issue is when I (with js) take the value of the textarea and put it into a p tag, it gets rid of all the line breaks. So what I need to do is replace the line breaks with <br> tags.

Only issue: I have no idea how.

<textarea id="articlePasteBin"></textarea>
<button onclick="build()">Build</build>

<p id="articleDisplay"></p>

<script>
   function build() {
      var art = document.getElementById("articlePasteBin").value
      document.getElementById("articleDisplay").innerHTML = art
      print()
   }
</script>
Jack Crane
  • 61
  • 5

0 Answers0