I have some cards like this:
And I draw them with this function:
let createCard = (header, price, category, size, type, show, img) => {
let card = document.createElement('div')
card.className = 'card drk'
document.querySelector('.container').appendChild(card)
card.innerHTML = `
<img src="${img}" alt="">
<div class="card-description">
<h3>${header}</h3>
<ul>
<li>Price: ${price}</li>
<li>Category: ${category}</li>
<li>Size: ${size}</li>
<li>Type: ${type}</li>
<li>Show: ${show}</li>
</ul>
<div class="button-holder">
<button class="MoreBtn">More</button>
<i class='bx bx-bookmark-alt'></i>
</div>
</div>
`
let menuBtn = document.querySelectorAll('.MoreBtn')
menuBtn.forEach (item => item.addEventListener('click', () => {
createMoreInfoCard(img, header, category, type, show, price)
}))
return card
}
And I want to trigger <- this function on specific button click. As you can see I tried forEach but on click, it triggers all the buttons. So I want to get one specific button.