单击后关闭对话框

时间:2013-04-26 20:26:03

标签: jquery-ui jquery

我打开一个对话框,将照片设置为个人资料头像图片,...如何在点击后关闭对话框?提前谢谢,...

<script type="text/javascript">
$(document).ready(function() {
    $('#profile_picture_dialog_<?php echo $profile['User']['id'] ?> a').each(function() {
        var $link = $(this);
        var $dialog = $('<div></div>')
            .load($link.attr('href'))
            .dialog({
            autoOpen: false,
            width: 500,
            modal: true,
            title: 'Set Profile Picture'
            });

        $link.click(function() {
            $dialog.dialog('open');

            return false;
        });
    });
});
</script>

这里是对话框内容:(推测)

  a href="/photos/ajax_set_buddy/148" Photo Image Here "/a"

1 个答案:

答案 0 :(得分:0)

试试这个:

   $link.click(function() {
        $dialog.dialog('open');

        $("#the-element-you-want-me-to-click").one("click", function() {
            $dialog.dialog('close');
        });

        return false;
    });