Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created April 18, 2025 14:21
Show Gist options
  • Save thinkphp/c7809ab9c0365813aba248856117271c to your computer and use it in GitHub Desktop.
Save thinkphp/c7809ab9c0365813aba248856117271c to your computer and use it in GitHub Desktop.
div
cartItem.innerHTML = `
<div class="item-info">
<h3 class="item-title">${item.name}</h3>
<div class="item-price">$${item.price.toFixed(2)} each</div>
</div>
<div class="item-controls">
<button class="decrease-quantity" data-id="${item.id}">-</button>
<span class="item-quantity">${item.quantity}</span>
<button class="increase-quantity" data-id="${item.id}">+</button>
<button class="remove-item" data-id="${item.id}" style="margin-left: 10px; background-color: #f44336;">×</button>
</div>
`;
cartItemsContainer.appendChild(cartItem);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment