0

在我正在处理的 Web 应用程序中,我通过 JqueryUI 对话框在“详细信息”页面上显示部分视图。我正在尝试在标题的右上角为关闭按钮添加一个 JqueryUI 工具提示,该工具提示与对话框一起提供。下面我有一些我的代码。由于我在下面的第二个功能,我知道脚本将从它们当前在此 Web 应用程序中的位置开始工作。'.ui-dialog-titlebar-close' 是应用于对话框标题中关闭按钮的类(基于 chrome firebug)。我找到的最接近解决方案的答案在这里https://forum.jquery.com/topic/tooltip-in-a-dialog-pop-up-without-hovering

发现这个问题与我的相似... 如何将 jquery 对话框中的“X”按钮更改为“关闭” ...任何方式我可以操纵关闭按钮来实现我这样的要求?例如“.addTitle()”??即将修补这个想法。

任何和所有的帮助或信息表示赞赏。

<script>
    $(function() {
    $('.ui-dialog-titlebar-close').tooltip({
        content: function () {
            return "test";
        }
    });
});

$(function () {
    $('#testThing').tooltip();
});

</script>

非常感谢, 摇滚

4

3 回答 3

2

我会尝试在您的对话框中使用 create 事件:

$("yourSelector").dialog({
   create: function(){$(".ui-dialog-titlebar-close").attr("title","Your text goes here");}
});
于 2013-09-12T19:24:13.317 回答
0

这可以通过编辑具有

.addClass("ui-dialog-titlebar-close ui-corner-all") 

在 'jquery.ui.dialog.js' 或 ('jquery.ui.all.js') 页面中,它当前读取

.attr('role', 'button')

只需将其更改为

.attr({'role': 'button', 'title': "close (Esc)")

这将解决问题

于 2013-12-18T06:55:40.297 回答
0

我认为最简单的解决方案是更新 jQuery UI 对话框的选项配置。喜欢:

$("#dialogConfirm").dialog({
    autoOpen : false,
    modal : true,
    resizable : false,
    dialogClass : "confirm-dialog",
    closeText : "Click to Close the dialog" // Here is the Gem
});
于 2015-07-17T08:30:50.973 回答