3

I'm using the following code to generate a textarea tag:

<%= text_area_tag :comment, '', autocomplete: "off", class: "form-control", placeholder: "Your Comment" %>

When rendered, it produces the following HTML:

<textarea name="comment" id="comment" autocomplete="off" class="form-control" placeholder="Your Comment"></textarea>

I know that if there is some text between <textarea> and </textarea>, the placeholder won't show up, but in my case, there is nothing in-between, as it is clear from rendered HTML. So how can I put a placeholder text for textarea?

Arslan Ali
  • 17,418
  • 8
  • 58
  • 76

1 Answers1

6

The html seems to be valid to me.

<textarea name="comment" autocomplete="off" class="test" id="moretest" data-value="moretest" placeholder="snowman or iceman?"></textarea>
Arslan Ali
  • 17,418
  • 8
  • 58
  • 76
Persijn
  • 14,624
  • 3
  • 43
  • 72