我有几个提交 AJAX 请求的按钮。
<%= button_to 'GO!', {controller:'videos', action:'rate', id: video.hashed_id, format: 'json'}, {:remote=>true, :class=>"btn btn-default btn-sm"} %>
如果我GO!
用<span class="glyphicaon glyphicon-thumbs-up"></span>
它替换最终会导致这个value="<span class="glyphicaon glyphicon-thumbs-up"></span>"
任何想法如何将字形图标放入提交表单的按钮中?
更新
我试过这个:
<%= button_to content_tag(:i, '', class: 'icon-thumbs-up'), {controller:'videos', action:'rate', id: video.hashed_id, format: 'json'}, {:remote=>true, :class=>"btn btn-default btn-sm"} %>
这创造了这个:
<form action="/videos/rate/asdfsxsdf/no.json" class="button_to" data-remote="true" method="post">
<div><input class="btn btn-default btn-sm" type="submit" value="<i class="icon-thumbs-up"></i>" />
<input name="authenticity_token" type="hidden" value="es4wPqFr9xPBUFsbHQR/gAzofDC+ZwYsiiJ7RAQZUHk=" />
</div></form>