【问题标题】:How can I show an apostrophe in the placeholder text on a rails form如何在 rails 表单的占位符文本中显示撇号
【发布时间】:2014-06-22 17:07:04
【问题描述】:
我想让我的表单有一个像
这样的占位符
请输入店铺地址
如何编辑下面的表格以使撇号起作用?
<%= text_area_tag 'store', '', class: 'form-control', placeholder: 'Please enter the store's address' %>
【问题讨论】:
标签:
html
ruby-on-rails
forms
erb
【解决方案1】:
你可以用反斜杠转义撇号:
<%= text_area_tag 'store', '', class: 'form-control', placeholder: 'Please enter the store\'s address' %>
或使用带引号的字符串文字:
<%= text_area_tag 'store', '', class: 'form-control', placeholder: "Please enter the store's address" %>