submit_tag rails表单中的引导图标

时间:2021-09-03 20:30:53

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:

我想在按钮中加入一个图标。我正在使用bootstrap,所以我必须包含以下代码:

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

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

¿是否知道如何在表单按钮中包含这些代码?

1 个解决方案

#1


89  

You can use button_tag instead of submit_tag:

您可以使用button_tag代替submit_tag:

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

#1


89  

You can use button_tag instead of submit_tag:

您可以使用button_tag代替submit_tag:

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