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

152
Views
Webpack + js. Problem with a getting element after render

I was training with some codes, so i have a problem. I have 2 consts in a webpack. First is a render. It works. There are some problems with div, it doesn't matter for me now.

const renderGoods =(goods) =>{
    // console.log("renderGoods")
    const goodWrapper = document.querySelector('.goods')
    console.log(goodWrapper)
    goodWrapper.innerHTML='';
    goods.forEach((goodsItem) => {
        goodWrapper.insertAdjacentHTML('beforeend',`
        <div class="card">
        ${goodsItem.sale ? '<div class="card-sale">🔥Hot Sale🔥</div>':''}
            <div class="card-img-wrapper">
            <span class="card-img-top"
                style="background-image: url('${goodsItem.img}')"></span>
            </div>
            </div>
        <div class="card-body justify-content-between">
            <div class="card-price">${goodsItem.price} ₽</div>
            <h5 class="card-title">${goodsItem.title}</h5>
            <button class="btn btn-primary to-corsine">В корзину</button>
        </div>
    </div>
    
        `)
    });
}
export default renderGoods

The second one needs elements from the first script. I want to get a button with class "to-corsine", but when i've tried - i had a zero-lenght array. My code to get an element is simple:

const corsine = function() {
    var things = [];
    var info = document.querySelector(".to-corsine");
    console.log(info);
}
export default corsine 

How can i get a full list of elements after render?

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!