我想获取 input.salePrice 的输入值。这是HTML:
<tr role="row" id="0">
<td class="v-align-middle semi-bold">TEST</td>
<td class="v-align-middle text-right quantityModule">
<div class="input-group">
<span class="input-group-addon primary"><a href="#" class="quantityMinus"><i class="fa fa-minus-circle"></i></a></span>
<input type="text" class="form-control text-center quantity" data-v-min="0" data-v-max="999" data-w-empty="zero" value="1" autocomplete="off" style="width:50px;">
<span class="input-group-addon primary"><a href="#" class="quantityPlus"><i class="fa fa-plus-circle"></i></a></span>
</div>
</td>
<td class="v-align-middle text-right priceModule">
<div class="input-group"><input type="text" class="form-control text-right salePrice" value="24.00" autocomplete="off" style="width:80px;"><span class="input-group-addon primary">%</span></div></td><td class="v-align-middle text-right">24.00
</td>
</tr>
我这样做错了:
$('#orderTable tbody').on('click', 'a.quantityPlus', function() {
var salePrice = $(this).parents('tr input.salePrice').val();
});
有什么想法吗?
答案 0 :(得分:1)
好的,这很简单,这是代码:
$('#orderTable tbody').on('click', 'a.quantityPlus', function() {
var tr = $(this).parents('tr').find('input.salePrice').val();
});