【发布时间】:2017-01-01 23:36:36
【问题描述】:
这是我的 HTML:
<tr>
<td colspan="2" class="borderBottomCell">
<div class="benefitInfo" style="WIDTH: 99%! important;">
<asp:DropDownList runat="server" ID="ddlbc1" />
<asp:Label runat="server" ID="lblbc1" />
<asp:Literal runat="server" ID="spcbc1" Text=" " />
<asp:Label runat="server" ID="bd1" />
<asp:HiddenField runat="server" ID="hdnbc1" />
</div>
</td>
<td class="borderBottomCell2">
<asp:TextBox runat="server" ID="amt1" CssClass="transparentTextBox amount" Width="60px" Columns="9" />
</td>
<td class="borderBottomCell2">
<asp:TextBox runat="server" ID="int1" CssClass="transparentTextBox" Width="60px" Columns="9" />
</td>
</tr>
我正在尝试获取对文本框 amt1 的引用。我需要循环使用它,因为这只是表格中的一行。我需要遍历下拉列表,如果 selectedIndex 大于零( > 0 ),金额文本框的金额必须大于零( > 0 )。我将在未来实现数据类型验证,目前我只需要知道如何通过我的循环访问相关的文本框。
到目前为止我有这个代码......
$(".benefitInfo select").each(function() {
var ddl = $(this);
});
实现这一目标的最佳方法是什么?我是否应该获得parent().parent().next().find(":input") 的参考...或者类似的东西?
【问题讨论】:
标签: javascript jquery html html-table