Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
swaraj-das committed Oct 24, 2024
1 parent 1b56e61 commit e9eb58c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
25 changes: 0 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -689,31 +689,6 @@ <h2>Feedback Form</h2>
</svg>
</button>

<script>
let cartItemCount = 0;
// document.querySelectorAll('#cart-btn').addEventListener('click', function () {
// cartItemCount++; // Increment cart count
// document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
// alert('Item added to cart'); // Show alert
// });


const cartButtons = document.querySelectorAll('#cart-btn');
cartButtons.forEach(button => {
button.addEventListener('click', function () {
cartItemCount++; // Increment cart count
document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
alert('Item added to cart'); // Show alert
});
});
// Function to handle Add to Cart button click
// document.getElementById('cart-btn').addEventListener('click', function () {
// cartItemCount++; // Increment cart count
// document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
// alert('Item added to cart'); // Show alert
// });

</script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

<script>
Expand Down
11 changes: 10 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,13 @@ function clearForm() {
// Load the form data when the page is loaded
window.onload = loadFormData;


let cartItemCount = 0;

const cartButtons = document.querySelectorAll('#cart-btn');
cartButtons.forEach(button => {
button.addEventListener('click', function () {
cartItemCount++; // Increment cart count
document.getElementById('cart-count').textContent = cartItemCount; // Update cart count display
alert('Item added to cart'); // Show alert
});
});

0 comments on commit e9eb58c

Please sign in to comment.