jQuery-ui对话框-使用jQuery隐藏按钮 [英] jQuery-ui dialog - hide buttons using jquery

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

问题描述

如何使用jquery动态删除/隐藏确定"按钮?

How do I remove/hide the "Ok" button dynamically using jquery?

$('#dialog-save').dialog({
            autoOpen: false,
            modal: false,
            draggable: true,
            width: 275,
            height: 175,
            buttons: {
                "Ok": function () {
                    $(this).dialog("close");
                }
            }
        });

我可以使用此代码更改标题-

I was able to change the title using this code -

var saveDialog = $('#dialog-save');
saveDialog.dialog('option', 'title', 'Message');

不确定如何删除按钮.谢谢!

Not sure how to remove the buttons. Thanks!

推荐答案

您可以设置 buttons 选项,方法与您设置标题相同:

You can set the buttons option in the same way you are setting the title:

saveDialog.dialog("option", "buttons", {});

传入一个空的对象常量以删除所有按钮.那应该没问题,因为您似乎只有一个按钮.如果要使用其他对象,只需在调用option方法时指定要保留的对象即可.

Pass in an empty object literal to remove all the buttons. That should be fine, since you appear to only have the one button. If you were to have others, just specify the ones you want to keep when you call the option method.

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

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