0

我正在尝试获取在弹出窗口中显示 div 的链接。

这是我的链接:

<li><a class="newAttachmentType" onclick="getFiles(true)">Move to somewhere</a></li>

这是我试图调用并放入弹出窗口的 div:

<div id="ddlFiles">
    <label>
        Select new CaseFile:</label>
    <asp:DropDownList runat="server" ID="ddlCaseFilesNew" DataSourceID="dsCaseFiles"
        DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" Width="300px" />
    <label>
        Select old CaseFile:</label>
    <asp:DropDownList runat="server" ID="ddlCaseFilesOld" DataSourceID="dsCaseFiles"
        DataTextField="Display" DataValueField="FileID" OnPreRender="ddl_PreRender" Width="300px" />
</div>

这是我迄今为止在“getFiles()”中尝试过的:

$('.newAttachmentType').click(function () {
   $('#newAttachmentDialog').dialog({
       autoOpen: true,
       height: 'auto',
       width: 'auto',
       modal: true,
       buttons: {
         "Save": function () {
            var attachmentName = $('#txtNewAttachmentName').val();
            if (attachmentName != "") {
                 var res;
                 PageMethods.addNewAttachmentType(attachmentName, reloadAttachmentTypes, res);
                 $(this).dialog('close');
            }
      },
      Cancel: function () {
            $(this).dialog('close');
      }
   },
   beforeClose: function () { $('#txtNewAttachmentName').val(''); }
 });
});
4

1 回答 1

1

您正在 onclick 方法内分配点击处理程序。为时已晚,没有任何效果。

无需像那样分配点击处理程序,只需直接执行代码即可。基本上解开内部函数:

$('#newAttachmentDialog').dialog({ 
   //Your code
});
于 2012-09-21T13:57:26.567 回答