rj487
rj487

Reputation: 4634

Rails text_area_tag break line with value

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

Upvotes: 0

Views: 348

Answers (1)

Deepak Mahakale
Deepak Mahakale

Reputation: 23661

Can you try with or "\n"

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

enter image description here

Upvotes: 2

Related Questions