添加css display:none到erb块/表单

时间:2014-03-16 05:58:24

标签: ruby-on-rails ruby erb

如何在此表单中添加display:none?

<%= form_tag(posts_path, :method => "get", id: "search-form", class: "nav-search-wrapper") do %>
    <%= text_field_tag :search, params[:search], placeholder: "Search" %>
    <%= submit_tag "Search", :name => nil %>
<% end %>

1 个答案:

答案 0 :(得分:2)

使用style: 'display: none;'

<%= form_tag(posts_path, :method => "get", id: "search-form", class: "nav-search-wrapper", 
    style: "display:none;") do %>
...
<% end %>