Answers for "get near element jquery"

2

get near element jquery

Closest 

<div class="product">
  <div class="product-counter">
     <div class="input-group-append">

       <div class="input-group-append">
         <button class="btn btn-outline-primary product-minus" type="button"> <i class="fas fa-minus"></i> </button>
       </div>

       <input type="text" class="form-control product-number" placeholder="1" value="1">

       <div class="input-group-append">
          <button class="btn btn-outline-primary product-plus" type="button"> <i class="fas fa-plus"></i> </button>
       </div>
    </div>
  </div>   
  <button class="btn btn-light product-order"> Order + </button>
</div>

------ 
ex: i am at .product-order
 
$(document).on('click', '.product-order', function(e) {

  var counter = $(this).closest('div').find('.product-counter');
  var number = $(this).closest('div.product').find('.product-number');
  var minus = $(this).closest('div.product').find('.product-minus');
  var plus = $(this).closest('div.product').find('.product-plus');
  
});
Posted by: Guest on September-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language