我有一个带文本框和单选按钮的转发器。我想要做的就是在弹出窗口(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());
}
});
});
我通过它获得了所选的单选按钮,但仍然在努力获取文本框值。
请帮助我获取文本框的价值。
由于
答案 0 :(得分:0)
试试这个:
if ($(this).find("input[type=radio][id*=rdSelectDaysToTransfer]").attr("checked")) {
var value = $(this).closest('tr').find('input.clsRptTxtDaysToTransfer').val();
alert(value);
}