0
4

2 回答 2

1

提交按钮不能包含任何嵌入的 html,因此您最好的选择是:

<button type="submit" class="btn btn-success btn-large" id="submit">
  <i class='icon-shopping-cart icon-large'></i> Checkout <%= number_to_currency(@item.price, precision: 0) %>
</button>
于 2013-05-07T22:28:02.627 回答
1

尝试使用button_tag,我没有测试它,但它接受一个块:

button_tag(type: 'submit', class: "btn btn-success btn-large") do
  "<i class='icon-shopping-cart icon-large'></i> Checkout (#{number_to_currency(@item.price, precision: 0)})".html_safe
end

在http://api.rubyonrails.org/中搜索“button_tag”

希望这可以帮助!

于 2013-05-07T22:49:18.957 回答