Reputation: 41
sorry for asking a question again but since my other question got answered I got a new problem
How am I able to give search_field_tag a class such as form-control? I tried multiple ways including this one for example:
<%= search_field_tag :q, '', html_options: { class: 'form-control' } %>
But this doesn't work. The field_tag gets invisible when trying it with this.
Any chance to do this? I googled up the documentation for search_field_tag and it says search_field_tag(name, value = nil, options = {})
.
Upvotes: 0
Views: 474
Reputation: 2321
<%= form_for "",url: cars_path, role: "search", method: :get ,class: "navbar-form navbar-right" do %>
<%= text_field_tag :search, @search_term,placeholder: "Search..." %>
<% end %>
OR
<%= search_field_tag :q, '', { :class => 'form-control' }) %>
Check out this example!
Upvotes: 0
Reputation: 6531
<%=search_field_tag :q, '', class: 'form-control', placeholder: 'Enter query'%>
Upvotes: 1