我有一个表,最后有复选框列。
HTML
<table border="1">
<thead>
<tr>
<td>Name</td>
<td>Amount</td>
<td>Selected Rows</td>
</tr>
</thead>
<tbody>
<tr>
<td>Item 1</td>
<td>5.0</td>
<td><input type="checkbox" checked="checked"/></td>
</tr>
<tr>
<td>Item 2</td>
<td>3.0</td>
<td><input type="checkbox" checked="checked"/></td>
</tr>
<tr>
<td>Item 3</td>
<td>4.0</td>
<td><input type="checkbox" checked="checked"/></td>
</tr>
</tbody>
</table>
Total : $<input type="text" value="12.0" />
jQuery
$('input[type=checkbox]').change(function(){
alert($(this).parent().parent().text());
});
我想根据使用复选框选择的行计算总值。该代码$(this).parent().parent().text();
给出了整行的文本值。如何单独获取金额列的值?