jquery对话框按钮太多

jquery dialog too many buttons

本文关键字:太多 按钮 对话框 jquery      更新时间:2023-09-26

这是我的jquery ui代码:

jQuery("#nodeliverydate").dialog({
    resizable:false,
    draggable:false,
    modal:false,
    buttons:[{text:"Close",click:function(){jQuery(this).dialog("close");}}]
});

这是一个使用jquery dialog作为警报框的非常简单的代码。我定义了一个按钮来关闭对话框。然而,它以一种非常奇怪的方式运行,即对话框将包含许多按钮,并且按钮上的文本都是函数名,如"each","all","clone","select","size", etc。在我关闭它之后,如果对话框再次显示,它将是正常的。有人知道为什么会发生这种事吗?

jQuery("#nodeliverydate").dialog({
                    modal: true, title: 'Delete msg', zIndex: 10000, autoOpen: true,
                    width: 'auto', resizable: false,
                    buttons: {
                        Yes: function () {
                            // $(obj).removeAttr('onclick');                                
                            // $(obj).parents('.Parent').remove();
                            $(this).dialog("close");
                        },
                        No: function () {
                            $(this).dialog("close");
                        }
                    },
                    close: function (event, ui) {
                        $(this).remove();
                    }
                });

这工作得很好:使用jQuery 的"是"或"否"确认框