Fran Martinez
Fran Martinez

Reputation: 3042

bootstrap icon in a submit_tag rails form

I have this form:

<%= form_tag(user_pages_path(current_user), :method => "get") do %>
  <%= text_field_tag :update, 'yes', type: "hidden"  %>
  <%= submit_tag "Update list", :class => "btn btn-default" %>
<% end %>

and I would like to include an icon in the button. I'm using bootstrap, so i must include this code:

<i class=" icon-repeat"></i>

¿Any idea about how to include this code in the form button?

Upvotes: 46

Views: 26623

Answers (1)

gabrielhilal
gabrielhilal

Reputation: 10769

You can use button_tag instead of submit_tag:

<%= button_tag(type: "submit", class: "btn btn-default") do %>
    Update list <i class="icon-repeat"></i>
<% end %>

Upvotes: 111

Related Questions