1

有谁知道如何删除表单标签?我试过了:

<%= comfy_form_for @comment, :as => :comment, options: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

<%= comfy_form_for @comment, :as => :comment, default: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

并且

<%= form.text_field :email, label: false, :class => 'form-control' %>

都无济于事……

4

2 回答 2

1

ComfortableMexicanSofa 正在使用https://github.com/bootstrap-ruby/rails-bootstrap-forms

所以我认为你需要这样做:

<%= f.text_area :email, hide_label: true %>

于 2015-07-17T14:16:38.290 回答
0

同样对于那些想要从 DOM 中完全删除标签的人,这里是如何实现它,根据rails-bootstrap-forms文档,您应该执行以下操作:

HTML:

 <%= form.text_area :content, :class => 'form-control', :rows => 5, placeholder: "Your comment", label_class: "removed-label" %>

CSS:

.removed-label {
  display: none;
}

希望它可以帮助某人。

于 2015-07-20T11:29:10.310 回答