我的形式很简单:
<%= simple_form_for @link do |f| %>
<%= f.input :url, placeholder: "http://..." %>
<%= f.button :submit, "Submit Link", class: "btn-primary" %>
<% end %>
输出如下输入:
<div class="form-group url required link_url">
<label class="url required control-label" for="link_url">
<abbr title="required">*</abbr> Url
</label>
<input class="string url required form-control" placeholder="http://..." type="url" name="link[url]" id="link_url">
</div>
我如何添加&#39; sr-only&#39; class to label element?
答案 0 :(得分:2)
只是做:
<%= f.input :url, placeholder: "http://...", label_html: { class: 'sr-only' } %>