Javascript 如何检索td输入文本框值?
在下表中,单击functionremoveRow,我想检索textbox TXTotalAmount的值 这是我写的Javascript 如何检索td输入文本框值?,javascript,jquery,Javascript,Jquery,在下表中,单击functionremoveRow,我想检索textbox TXTotalAmount的值 这是我写的 function removeRow(name) { $(name).parent().parent().remove(); var total = $(name).parent().parent().siblings().find("input .classTotalAmount").val(); alert(total);// shows only undef
function removeRow(name) {
$(name).parent().parent().remove();
var total = $(name).parent().parent().siblings().find("input .classTotalAmount").val();
alert(total);// shows only undefined in alert box
}
这是我的桌子
<table id="tblitems" cellpadding="0" cellspacing="0" border="0" class="additemtb">
<tbody>
<tr>
<th>Item Name</th>
<th>Item Code</th>
<th>Unit Price</th>
<th>Qty</th>
<th>UOM</th>
<th>Amount</th>
<th>Minimal Order Qty</th>
<th>FOC</th>
<th></th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="width:90px;">
<a href="javascript:void(0)" class="copy" onclick="copyRow(this);">Copy</a>
<a href="javascript:void(0)" class="delete" onclick="removeRow(this);">delete</a>
<a href="javascript:void(0)" class="add" onclick="addRows(this)">add</a>
</td>
</tr>
<tr>
<td></td>
<td >Total Amount</td>
<td>
<asp:TextBox ID="txtTotalAmount" CssClass="classTotalAmount number" Columns="8" runat="server" ></asp:TextBox>
<asp:Label ID="Label2" runat="server" CssClass="classCurrency3" />
</td>
<td> </td>
</tr>
</tbody>
</table>
哪张桌子?放入html代码
var amount = $("#txtTotalAmount").val();