asp.net – $(“#dialog”).parent().appendTo($(“form:first”));

我正在我的页面上打开几个jQuery对话框,我正在使用:
$("#dialog2").parent().appendTo($("form:first")); //This was working,no problem.

我注意到,当我再次将它应用于dialog3时,它已经停止了该对话框的工作.如何将它用于不同的对话框?

$("#dialog2").dialog({
    bgiframe: false,autoOpen: false,height: 410,width: 800,modal: true,draggable: true,resizable: true
});

$("#dialog2").parent().appendTo($("form:first")); //doesn't work Now

$("#dialog3").dialog({
    bgiframe: false,width: 600,resizable: true
});

$("#dialog3").parent().appendTo($("form:first"));

HTML:

<div id="dialog3" title="Attachments">
    <p id="P1">
        <asp:Button ID="btnAttach" runat="server" Text="Attach files" class="float-left ui-button"/></p>
    <fieldset>

    </fieldset>
</div>


<div id="dialog2" title="Notes">
    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/icons/user_comment.png" />
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Larger" Text="Notes"></asp:Label>
    <br />
    &nbsp;
    <div style="overflow: auto; height: 310px; width: 780px;">
        <fieldset>
            <br />
            <asp:TextBox ID="txtNote" runat="server" CssClass="notetext" Width="740px" Rows="6"
                TextMode="MultiLine" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
            <br />
            &nbsp;
            <div style="width: 743px">
                <asp:Button ID="btnNoteSave" runat="server" Text="Save" class="float-right ui-button" />
            </div>
        </fieldset>
    </div>

解决方法

更好的一个
$('#dialog2').dialog({
      open:function(){{
         $(this).parent().appendTo($("form:first"));
      }}
});

$('#dialog3').dialog({
      open:function(){{
         $(this).parent().appendTo($("form:first"));
     }}
});

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...