1

我有一个带有文本框和单选按钮的转发器。我要做的就是在弹出窗口(jqmWindow)关闭时获取选定的文本框值。

<div class="jqmWindow" id="dialog" style="display: none;">
    <table width="100%" border="0px" cellpadding="0px" cellspacing="0px">
        <tr>
            <td>
                <asp:Repeater runat="server" ID="rptDaysInField" EnableViewState="false">
                    <HeaderTemplate>
                        <table id="tblPopUp" class="clsForm spacing" style="behavior: url(../script/tablehighlight.htc);"
                            hlcolor="#CECECE" slcolor="#CECECE">
                            <thead>
                                <tr class="header">
                                    <td width="0%">
                                    </td>
                                    <td width="40%">
                                        <MultiLang:LocalizedLiteral ID="LocalizedLiteral2" runat='server' Key="CoacheeName">
                                        </MultiLang:LocalizedLiteral>
                                    </td>
                                    <td width="20%">
                                        <MultiLang:LocalizedLiteral ID="LocalizedLiteral9" runat='server' Key="SessionDate">
                                        </MultiLang:LocalizedLiteral>
                                    </td>
                                    <td width="10%">
                                        <MultiLang:LocalizedLiteral ID="LocalizedLiteral10" runat='server' Key="# Days">
                                        </MultiLang:LocalizedLiteral>
                                    </td>
                                    <td width="20%">
                                        <MultiLang:LocalizedLiteral ID="LocalizedLiteral11" runat='server' Key="Days To Transfer">
                                        </MultiLang:LocalizedLiteral>
                                    </td>
                                    <td width="10%">
                                    </td>
                                </tr>
                            </thead>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr>
                            <td width="0%">
                                <asp:HiddenField ID="hidId" runat="server" Value='<%#(DataBinder.Eval(Container, "DataItem.CoacheeId"))%>' />
                            </td>
                            </td>
                            <td width="40%">
                                <%# DataBinder.Eval(Container, "DataItem.CoacheeName")%>
                            </td>
                            <td width="20%">
                                <%# DataBinder.Eval(Container, "DataItem.SessionDate")%>
                            </td>
                            <td width="10%">
                                <%# DataBinder.Eval(Container, "DataItem.Days")%>
                            </td>
                            <td width="20%">
                                <asp:TextBox ID="rptTxtDaysToTransfer" class="clsRptTxtDaysToTransfer" runat="server"></asp:TextBox>
                            </td>
                            <td width="10%">
                                <asp:RadioButton ID="rdSelectDaysToTransfer" class="clsRdSelectDaysToTransfer" runat="server" />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
    <a href="#" class="jqmClose" id="dialogClose" style="float:right;">Close</a>
</div>

我正在使用下面的 jQuery 代码:

$(".jqmClose").click(function () {
            $(".clsRdSelectDaysToTransfer").each(function () {
                if ($(this).find("input[type=radio][id*=rdSelectDaysToTransfer]").attr("checked")) {
                    alert($(this).find(".clsRptTxtDaysToTransfer input[type=text][id*=rptTxtDaysToTransfer]").val());
                }
            });
        });

通过它我得到了选定的单选按钮,但仍然难以获得文本框的值。

请帮助我获取文本框的值。

谢谢

4

1 回答 1

0

试试这个:

if ($(this).find("input[type=radio][id*=rdSelectDaysToTransfer]").attr("checked")) {
    var value = $(this).closest('tr').find('input.clsRptTxtDaysToTransfer').val();
    alert(value);
}​
于 2012-12-24T18:34:41.397 回答