从元素关闭一个jQuery用户界面对话框里面它? [英] Close a jQuery UI Dialog from an element inside of it?

查看:97
本文介绍了从元素关闭一个jQuery用户界面对话框里面它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一个简单的问题,这可能是简单的比我正在考虑。

Here's a quick question that's probably simpler than I'm thinking.

我用填充从$。阿贾克斯()调用的结果HTML中的jQuery用户界面对话框。在某些情况下,这包括HTML,单击时,我想关闭该对话框包含一个按钮。

I'm populating a jQuery UI dialog with the resulting html from an $.ajax() call. In certain cases that html includes a button that when clicked, I want to close the containing dialog.

假设我不知道被指定为使用 $(#元素)对话框元素事情。对话框() ...(比如我不知道的#element选择是从对话框的内部内容是什么) - 什么是从一个元素关闭对话框,点击它里面的最好方法是什么?

Assuming that I don't know anything about the element that was specified to be the dialog using $("#element").dialog()...(i.e. I have no idea what the "#element" selector is from the dialog's inner content) - What's the best way to close the dialog from an element clicked inside of it?

推荐答案

使用最接近()

$(this).closest('.ui-dialog-content').dialog('close');

这篇关于从元素关闭一个jQuery用户界面对话框里面它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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