jQuery UI:对话框按钮样式 [英] jQuery UI: Dialog button styling

查看:119
本文介绍了jQuery UI:对话框按钮样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个简单的方法来应用CSS /图标到一个jQuery UI模态对话框上的模态按钮?

Is there an easy way to apply CSS/icons to the modal buttons on a jQuery UI modal dialog box?

如果我包括HTML显示一个图标按钮文本,它将HTML显示为文本,而不是呈现代码。

If I include the HTML to display an icon with the button text, it shows the HTML as text rather than rendering the code.

我猜我可以写一些jQuery来找到按钮,我想要,但我希望有一个更简单更直接的方式。

I'm guessing I could write some jQuery to find the button and overwrite the HTML with what I want, but I'm hoping there's an easier more direct way.

推荐答案

我可以看到它的老问题,现在在jQuery UI中更好的方式,只需添加'类'或'样式'属性到按钮对象像这样:

I can see its pretty old question but you can do it now in much nicer way in jQuery UI, just add 'class' or 'style' properties to button object like this:

$("#id-dialog").dialog({
    modal: true,
    buttons: [
        { text: "Save", click: function () { alert("save"); }, class:"sampleClass1", style:"color:Red" },
        { text: "Cancel", click: function () { alert("close"); ;}, class:"sampleClass2"}
    ]
});  

这篇关于jQuery UI:对话框按钮样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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