Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
Jquery select current element in list

I need to select the current element from the list:

$(".card.v1 .buy-wrapper input[type='number'], .coupon-quantity, .product-buy-wrapper input, .cart-item .buy-wrapper input, .card.v2 .buy-wrapper input[type='number']").on("change", function(e) {
    currentValue = $(this).val();
    id = $(this).parent().find(".buy-button").data("product-id");
    console.log(id);
    if (currentValue == 0) {
        $(this).parent().find(".buy-button").fadeIn("slow");
        $(this).parent().find(".input-group").hide();
        $(this).val("1");
    }
})

$(this) select all data product-id in selector list and give me data from another inputs, i need data only from current changed input, not all in selector list.

event.target.id return undefined.

UPD:

<div class="buttons mt-2 d-flex">
    <div class="buy-wrapper order-1 order-lg-0 mr-3">
        <button type="button" data-product-id="<?= $value->id; ?>" class="btn btn-primary btn-lg buy-button">Buy</button>
        <input class="form-control qty" type="number" value="1" min="0" max="100" step="1">
    </div>
</div>

This block is also in other places

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!