0

I have an array, and I need to print these value line by line in a textarea.

According to the answer.

I thought I can print html by this way.

<textarea id="t">Line 1&#10;Line 2</textarea>

Therefore, here is what I wrote.

Note: @parameter = ["Line1", "Line2"]

<span class="edit">
  <%= text_area_tag('list', @parameter.join('&#10;'))%>
</span>

However, I got this

enter image description here

instead of this

enter image description here

Community
  • 1
  • 1
rj487
  • 4,476
  • 6
  • 47
  • 88

1 Answers1

2

Can you try with or "\n"

<span class="edit">
  <%= text_area_tag('list', @parameter.join("\n"))%>
</span>

enter image description here

Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88