I have element structure as follows:
<div class="qty-adjust-inner">
<a class="btn btn-min">
<font style="vertical-align: inherit;"><font style="vertical-align: inherit;">-</font></font>
</a>
<div class="value">
<input type="hidden" value="1" />
<span data-bind="text: $parent.qty" class="qty_value">
<font style="vertical-align: inherit;"> <font style="vertical-align: inherit;" class="">120</font></font>
</span>
</div>
<a class="btn btn-plus">
<font style="vertical-align: inherit;"><font style="vertical-align: inherit;">+</font></font>
</a>
</div>
I need to increment/decrement the value "120" on .btn-min
and .btn-plus
class buttons.
I tried to access the value using var value = $('.btn-min').find('.value').html();
and also find, children but not getting the results.
Edit: As pointed out by @Taplar the value section is not a child of the anchor tag. The problem is there are many anchor tags like these, and I need to increment the very next adjacent value having class value
As element containing .value class is a children of element containing .qty-adjust-inner you can search something like.
$('.qty-adjust-inner').find(".value").find('span').text().trim()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With