问题从jQuery对话框获取对话框标题 [英] problem getting dialog title from jquery dialog

查看:109
本文介绍了问题从jQuery对话框获取对话框标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在获取对话框标题时遇到问题

这是代码,然后弹出弹出的警报,提示 [object],[object]
我尝试了许多不同的解决方案,但是没有用

我必须使标题具有动态性,并且不能直接调用对话框ID.

Hi, i have a problem getting the title of the dialog

this is the code, gut the alert that pops up says [object], [object]
i have tried many different sollutions but it''s not working

i have to get the title dynamic and can''t call the dialog id direcly.

the ID of the

$('.ui-dialog-titlebar').mouseup(function () {
    alert($(this).parent().children('#ui-dialog-title-dialog').dialog("option", "title"));
});



我已经用谷歌搜索了,但是还没有找到解决方法.

有人知道解决方案吗,谢谢!



i have googled it, but haven''t found the solution.

does any one know the solution, thanks!

推荐答案

(' .ui-dialog-titlebar').mouseup(function(){ alert(
('.ui-dialog-titlebar').mouseup(function () { alert(


( this ).parent().children(' #ui-dialog-title-dialog').dialog(" 标题"))); });
(this).parent().children('#ui-dialog-title-dialog').dialog("option", "title")); });



我已经用谷歌搜索了,但是还没有找到解决方法.

有人知道解决方案吗,谢谢!



i have googled it, but haven''t found the solution.

does any one know the solution, thanks!


您正在此处直接调用对话框函数(.dialog).那将返回一个jQuery包装的对象

对话框的标题正是您在参数dialog中指定的标题("option"," title ")!

这是.dialog函数生成的一些HTML

You are calling the dialog function (.dialog) in line there. That will return a jQuery wrapped object

The title of the dialog is exactly what you''ve specified in the arguments dialog("option", "title")!

Here is some HTML generated by the .dialog function

<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
    <span class="ui-dialog-title" id="ui-dialog-title-dialog">Dialog Title</span>
    <a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button">
    <span class="ui-icon ui-icon-closethick">close</span></a>
</div>



所以说真的,您要做的就是获取ui-dialog-titlebar类元素的 child ,它应该像这样



So really, what you want to do is get the child of the ui-dialog-titlebar class element, which should read like this


这篇关于问题从jQuery对话框获取对话框标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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