There is a set of product-section product sections. By button + specific section, you need to get the amount to continue to work with it. But I can't get to the upper field quantity via this . How can I do that?
$('.product-section .product-quantity .plus').click(function() { var $this = $(this); var quantity = $this.find(".quantity").text().match(/\d+(?:\.\d+)?/g); var basePrice = ""; for (var i = 1; i < quantity.length; i++) { basePrice += quantity[i]; } console.log(basePrice); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="product-section"> <table class="description-table"> <tbody> <tr> <td class="product-quantity"> <div class="quantity buttons_added"> <input type="number" step="1" min="1" max="27" id="num_count" name="quantity" value="1" title="Кол." class="input-text qty text" size="4"> <input type="button" value="+1" id="button_plus" class="plus"> <input type="button" value="-1" id="button_minus" class="minus"> </div> </td> </tr> </tbody> </table> </div>
id="num_count"- Vasya