如何更改jquery对话框按钮 [英] how to change jquery dialog buttons

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

问题描述

我想用我自己按钮的图像替换jquery对话框的按钮。这样做最干净的方法是什么?

I would like to replace the jquery dialog's buttons with images of my own buttons. What is the tidiest way of doing this?

按钮上不会叠加任何文字。我正在使用jquery 1.4.2和jquery-ui 1.8.1

There will be no text overlayed on the buttons. I am using jquery 1.4.2 and jquery-ui 1.8.1

推荐答案

也许在对话框的打开事件中检索按钮并删除ui-button类并添加自己的类。

Maybe in the open event of the dialog retrieve the buttons and remove the ui-button classes and add your own.

var buttons = $(dialog_selector + ' .ui-dialog-buttonpane button');
for (var i = 0; i < buttons.length; ++i) {
    $(buttons[i]).removeClass('ui-button-text-only').removeClass('ui-button'.addClass('yourclass');
}

这篇关于如何更改jquery对话框按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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