I cannot seem to find the answer to this.
My tag looks like this:
<%= form.text_field :event_location, :required => true, nil, placeholder: "Location" %>
Which isn't working, and is throwing a syntax error. How do I add a placeholder to my text_field form helper tag?
I've also tried these which also do not work:
<%= form.text_field :event_location, :required => true, "", placeholder: "Location" %>
<%= form.text_field :event_location, :required => true, :placeholder => "Location" %>
<%= form.text_field :event_location, :required => true, :attr, :placeholder => "Location" %>
<%= form.text_field :event_location, :required => true, :attr, "", placeholder: "Location" %>
Answer was simply:
<%= form.text_field :event_location, :required => true, placeholder: "Location" %>
Not sure why this was not documented anywhere.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.