1Closest
2
3<div class="product">
4 <div class="product-counter">
5 <div class="input-group-append">
6
7 <div class="input-group-append">
8 <button class="btn btn-outline-primary product-minus" type="button"> <i class="fas fa-minus"></i> </button>
9 </div>
10
11 <input type="text" class="form-control product-number" placeholder="1" value="1">
12
13 <div class="input-group-append">
14 <button class="btn btn-outline-primary product-plus" type="button"> <i class="fas fa-plus"></i> </button>
15 </div>
16 </div>
17 </div>
18 <button class="btn btn-light product-order"> Order + </button>
19</div>
20
21------
22ex: i am at .product-order
23
24$(document).on('click', '.product-order', function(e) {
25
26 var counter = $(this).closest('div').find('.product-counter');
27 var number = $(this).closest('div.product').find('.product-number');
28 var minus = $(this).closest('div.product').find('.product-minus');
29 var plus = $(this).closest('div.product').find('.product-plus');
30
31});
32