<tr role="row" class="odd parent">
<td class="quantity"><input type="text"></td>
</tr>
<tr class="child">
<td class="child" colspan="8">
<li data-dtr-offset-index-"7">
<span class="dtr-title"></span>
<span class="dtr-data">
<button type="button" class="btn btn-primary">Add to Cart</button>
</span>
</li>
</td>
</tr>
The parent row has an input for quantity. The child row has a button. I want to click the button and return the quantity. So far I've tried:
$(".btn-primary").click(function(e) {
var qty = $(this).closest("input").val();
});
But this returns undefined.
Can someone help?
Thanks in advance!!
inputtag in your html?