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

143
Views
İ can't pull data with JavaScript

I want to pull data using JavaScript and show it in console. I don't know what I did wrong.

main.js

// ADD TO CART
$("#addToCartBtn").on('click',function(){
  var _qty=$("#productQty").val();
  var _productId=$(".product-id").val();
  var _productName=$(".product-name").val();
  console.log(_productId,_productName,_qty);
});

I am using django framework to write backend

detail.html

<div class="product-btns">
    <div class="qty-input">
        <span class="text-uppercase">Ədəd: </span>
        <input class="input" type="number" value="1" id="productQty">
    </div>
    <input type="hidden" class="product-id" value="{{product.id}}">
    <input type="hidden" class="product-name" value="{{product.name}}">
    <button class="primary-btn add-to-cart"><i class="fa fa-shopping-cart" id="addToCartBtn"></i> Səbətə at</button>
</div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is probably that the element that has id="addToCartBtn" is not really the button but the <i> element - which has no content and therefore no width. So it is never clickable.

about 4 years ago · Juan Pablo Isaza Report
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!