Rails 3提交标签+ html_safe [英] Rails 3 Submit Tag + html_safe

查看:90
本文介绍了Rails 3提交标签+ html_safe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这行代码有什么问题?

What's wrong with this line of code?

<%= submit_tag "Delete <i class='icon-check'></i>".html_safe, :disable_with => "Deleting", :class => "btn btn-danger"%>

这实际上产生了:

很明显,我的html_safe调用没有执行任何操作.

Evidently my html_safe call isn't doing anything.

背景:

我正在使用 Twitter引导程序

I'm using Twitter Bootstrap as well as Font Awesome and I'm essentially trying to achieve a submit button with an icon inside of it.

推荐答案

要扩展Lukas的答案,我需要一个按钮标签而不是一个输入标签.这段代码产生了我想要的效果:

To extend on Lukas' answer I needed a button tag rather than an input. This code produced the effect I was looking for:

<button type="submit" class="btn btn-danger">
    Delete <i class="icon-check"></i> 
</button>

导致的结果:

我在在这里找到了答案.

这篇关于Rails 3提交标签+ html_safe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆