如何关闭对话框中的jQuery对话框? [英] How to close jQuery Dialog within the dialog?

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

问题描述

如何在不使用关闭按钮的情况下关闭对话框中的jQuery对话框?

How to close jQuery Dialog within the dialog without using the close button?

在ui对话框中是一个简单的表单请求,如果成功提交,则ui对话框会自动关闭并刷新父页面.

Inside the ui dialog is a simply form request and if a successful submission occurs, then the ui dialog automatically closes and refreshes the parent page.

    <script type="text/javascript">
        $(document).ready(function () {
            $("#form-dialog").dialog({
                autoOpen: true,
                modal: true,
                width: 200,
                draggable: true,
                resizable: true
            });
        });
    </script>


    <div id="form-dialog" title="Form Submit">
    <form action="default.aspx" method="post">
    <input type="text" name="name" value=" " />    
    <input type="submit" value="submit" />

    <a href="#" id="btnDone">CLOSE</a>

    <script type="text/javascript">
    $(document).ready(function () {
        $("#btnDone").click(function () {
            $(this).dialog('close');
        });
    });
    </script>

    </form>
    </div>

-imperialx

-imperialx

推荐答案

尝试一下

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

它将关闭其中的对话框.

It will close the dialog inside it.

这篇关于如何关闭对话框中的jQuery对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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