javascript - 对话框关闭按钮上的 Jquery 工具提示

标签 javascript jquery jquery-ui-dialog jquery-ui-tooltip

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

发现这个问题和我的很相似... How to change the 'X' button in a jquery dialog box to read 'Close' ...我可以通过任何方式操纵关闭按钮来实现我这样的要求吗?例如“.addTitle()”?即将修改这个想法。

感谢任何和所有帮助或信息。

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

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

</script>

非常感谢, 摇滚

最佳答案

我会尝试在对话框上使用创建事件:

$("yourSelector").dialog({
   create: function(){$(".ui-dialog-titlebar-close").attr("title","Your text goes here");}
});

关于javascript - 对话框关闭按钮上的 Jquery 工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18233453/

相关文章:

javascript - 使用 jQuery 从 JSON 树读取特定值

javascript - 使用 jquery 删除更改​​时的复选框背景颜色

javascript - 在 jQueryUI 对话框中显示和格式化数组元素

jquery-ui - jQueryUI 对话框 - 按钮文本不出现

javascript - Node JS : Extract a sentence from html text based on a phrase

javascript - react-redux:了解 Provider 和代表性组件之间的通信

javascript - NgFor 中的 Angular 表单验证

jquery - 将鼠标悬停在链接上时使用 slideDown 效果更改 div 的背景

javascript - 将 javascript 值传递给 PHP

jquery ui - 嵌套对话框 z 索引问题