我需要第一个td输入类型占位符值在上次td按钮单击时的值,我怎么能得到它。我按照以下方式进行。如何获取同级td文本框值的值?
$(".prodcs").click(function() {
var qty =$(this).prevAll(':eq(2)').find('#qty').attr('placeholder').val();
//$(this).closest('td').find('#qty').val();
alert(qty);
});
但它不工作。
<tr>
<td width="170">
<input type="text" class="form-control" placeholder="1" id="qty">
</td>
<td width="560">
<select name="DDL" id="DDL" class="form-control"><option value="1">7'' - £10.00</option>
<option value="2">14'' - £15.00</option>
<option value="6">5'' - £5.00</option>
<option value="7">500 M- £15.00</option>
</select> </td>
<td width="102" align="right">
<a data-toggle="modal" href="#myModal" data-productid="3" id="product_3" class="btn btn-primary btn-lg popup prodcs">Customisation</a>
</td>
<td width="101" align="right">
<button type="button" class="btn btn-default">
<i class="glyphicon glyphicon-shopping-cart" style="font-size: 20px; color: #666"></i>
</button>
</td>
</tr>
什么图莎尔说 - 你有'.attr( '占位')VAL();'。如果你想占位符 – Ted