如何在此表单中添加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 %>
答案 0 :(得分:2)
使用style: 'display: none;'
:
<%= form_tag(posts_path, :method => "get", id: "search-form", class: "nav-search-wrapper",
style: "display:none;") do %>
...
<% end %>